NO

Author Topic: [SOLVED] v8 RC6 wchar.h + windows.h FILE issues?  (Read 3272 times)

DYSEQTA

  • Guest
[SOLVED] v8 RC6 wchar.h + windows.h FILE issues?
« on: September 04, 2014, 01:13:12 PM »
Since installing RC6 of PellesC v8 I have been having issues when wchar.h and windows.h are used together. Here is and example compile error I am seeing when wchar.h is included before windows.h:

Code: [Select]
C:\PellesC\Include\wchar.h(267): error #2095: Expected type for parameter 4, but found 'FILE'.
C:\PellesC\Include\wchar.h(267): error #2048: Undeclared identifier 'FILE' (did you mean 'HFILE'?).
C:\PellesC\Include\wchar.h(268): error #2095: Expected type for parameter 3, but found 'FILE'.
C:\PellesC\Include\wchar.h(268): error #2048: Undeclared identifier 'FILE' (did you mean 'HFILE'?).

If I include wchar.h after windows.h I get:

Code: [Select]
C:\PellesC\Include\wchar.h(267): error #2095: Expected type for parameter 4, but found 'FILE'.
C:\PellesC\Include\wchar.h(267): warning #2099: Missing type specifier; assuming 'int'.
C:\PellesC\Include\wchar.h(267): error #2001: Syntax error: expected ')' but found '*'.
C:\PellesC\Include\wchar.h(267): error #2001: Syntax error: expected ';' but found ')'.
C:\PellesC\Include\wchar.h(268): error #2095: Expected type for parameter 3, but found 'FILE'.
C:\PellesC\Include\wchar.h(268): warning #2099: Missing type specifier; assuming 'int'.
C:\PellesC\Include\wchar.h(268): error #2001: Syntax error: expected ')' but found '*'.
C:\PellesC\Include\wchar.h(268): error #2001: Syntax error: expected ';' but found ')'

Both __STDC_WANT_LIB_EXT1__ and __STDC_WANT_LIB_EXT2__ are defined as part of my flags passed to pocc.

At first I thought it was me and I had introduced some bug in my code somewhere but I have been pulling my hair out for many hours now and as long as wchar.h and windows.h are in the same compile I get this issue so I am thinking its not me after all :(

Any ideas?
« Last Edit: September 07, 2014, 04:10:19 AM by DYSEQTA »

DYSEQTA

  • Guest
Re: v8 RC6 wchar.h + windows.h FILE issues?
« Reply #1 on: September 04, 2014, 02:14:00 PM »
I knew the moment I posted here that  I would finally sort it out...

I needed the /Zx compiler option.

DYSEQTA

  • Guest
Re: v8 RC6 wchar.h + windows.h FILE issues?
« Reply #2 on: September 06, 2014, 04:09:20 PM »
Actually I take that back. I just added wchar.h into a source file from the glfw library to get at wcslen(), which is not in string.h as it is in other std library implementations and up pops that error again:
Code: [Select]
C:\PellesC\Include\wchar.h(267): error #2095: Expected type for parameter 4, but found 'FILE'.
C:\PellesC\Include\wchar.h(267): error #2048: Undeclared identifier 'FILE' (did you mean 'HFILE'?).
C:\PellesC\Include\wchar.h(268): error #2095: Expected type for parameter 3, but found 'FILE'.
C:\PellesC\Include\wchar.h(268): error #2048: Undeclared identifier 'FILE' (did you mean 'HFILE'?).

Has something been broken in wchar.h or windows.h between RC5 and RC6?

EDIT: Further to the above this error only occurs with __STDC_WANT_LIB_EXT2__ defined.
« Last Edit: September 06, 2014, 04:44:15 PM by DYSEQTA »

JohnF

  • Guest
Re: v8 RC6 wchar.h + windows.h FILE issues?
« Reply #3 on: September 06, 2014, 04:58:34 PM »
wchar.h uses struct FILE if you define __STDC_WANT_LIB_EXT2__,
so include stdio.h first.

John
« Last Edit: September 06, 2014, 05:42:59 PM by JohnF »

DYSEQTA

  • Guest
Re: v8 RC6 wchar.h + windows.h FILE issues?
« Reply #4 on: September 07, 2014, 04:09:59 AM »
Thanks John, you're a genius, or should I say that I am not ;)

JohnF

  • Guest
Re: [SOLVED] v8 RC6 wchar.h + windows.h FILE issues?
« Reply #5 on: September 07, 2014, 08:52:44 AM »
Yes, well I don't think the word genius fits well with the view of myself. :)

John