If I add __STDC_WANT_LIB_EXT2__ to preprocessor symbols these errors are reported.
..\stdio.h(273): error #1019: Syntax error in #if/#elif expression.
..\string.h(113): error #1019: Syntax error in #if/#elif expression.
..\wchar.h(238): error #1019: Syntax error in #if/#elif expression.
and with __STDC_WANT_LIB_EXT1__ I get these.
..\stdio.h(224): error #1019: Syntax error in #if/#elif expression.
..\stdlib.h(183): error #1019: Syntax error in #if/#elif expression.
..\string.h(79): error #1019: Syntax error in #if/#elif expression.
..\wchar.h(188): error #1019: Syntax error in #if/#elif expression.
John
Cannot replicate, next time you post a bug it would be helpful to include more details.
#define __STDC_WANT_LIB_EXT2__
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <io.h>
John
Hi John.
Giving a value to __STDC_WANT_LIB_EXT2__ solves the problem.
#define __STDC_WANT_LIB_EXT2__ 1
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <io.h>
This comes from the test in stdio.h and string.h:
#if __STDC_WANT_LIB_EXT2__
It would have worked should it have been:
#ifdef __STDC_WANT_LIB_EXT2__
I don't know if this could be a bug. I would expect that the preprocessor should resolve to a value=0 for both undefined symbol and for a definition without a value.
P.S. PellesC help anyway states:
QuoteTo enable the extended functions in Pelles C, define the macro __STDC_WANT_LIB_EXT2__ as the integer constant 1.
EDIT: OK I have got it. #if deals only with numbers, and the code:
#if something
Is equivalent by default to:
#if something != 0
The definition of a symbol without a value is an undefined type and triggers the error.
Not a bug. 8)
Well done Frankie, thanks.
John