NO

Author Topic: LIB_EXT errors  (Read 3242 times)

JohnF

  • Guest
LIB_EXT errors
« on: June 17, 2014, 08:12:42 PM »
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
« Last Edit: June 17, 2014, 08:14:57 PM by JohnF »

neo313

  • Guest
Re: LIB_EXT errors
« Reply #1 on: June 17, 2014, 10:38:48 PM »
Cannot replicate, next time you post a bug it would be helpful to include more details.

JohnF

  • Guest
Re: LIB_EXT errors
« Reply #2 on: June 18, 2014, 06:54:37 AM »
#define __STDC_WANT_LIB_EXT2__
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <io.h>

John

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2113
Re: LIB_EXT errors
« Reply #3 on: June 18, 2014, 10:01:47 AM »
Hi John.
Giving a value to __STDC_WANT_LIB_EXT2__ solves the problem.
Code: [Select]
#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:
Code: [Select]
#if __STDC_WANT_LIB_EXT2__
It would have worked should it have been:
Code: [Select]
#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:
Quote
To 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:
Code: [Select]
#if something
Is equivalent by default to:
Code: [Select]
#if something != 0
The definition of a symbol without a value is an undefined type and triggers the error.
Not a bug. 8)
« Last Edit: June 18, 2014, 10:28:11 AM by frankie »
"It is better to be hated for what you are than to be loved for what you are not." - Andre Gide

JohnF

  • Guest
Re: LIB_EXT errors
« Reply #4 on: June 18, 2014, 11:04:20 AM »
Well done Frankie, thanks.

John