msvcrt vs std incl
davidf at sjsoft.com
Tue Nov 19 09:26:13 CST 2002
Dimitrie O. Paun wrote:
>On November 19, 2002 09:46 am, Dimitrie O. Paun wrote:
>>[dimi at dimi wine]$ gcc -nostdinc -fshort-wchar -I /home/dimi/dev/wine/wine.src/include/msvcrt -I /home/dimi/dev/wine/wine.src/include test.c
>Hm, maybe we need the standard headers after all.
>Even though this might create confusion.
>Nevertheless, they solve only part of the problem:
>[dimi at dimi wine]$ gcc -fshort-wchar -I /home/dimi/dev/wine/wine.src/include/msvcrt -I /home/dimi/dev/wine/wine.src/include test.c
>test.c: In function `main':
>test.c:8: `wchar_t' undeclared (first use in this function)
>test.c:8: (Each undeclared identifier is reported only once
>test.c:8: for each function it appears in.)
>This shouldn't have, should it?
This actually happens whether you do -fshort-wchar or not.
The question is, where is wchar_t defined?
The answer seems to be, in stddef.h
However, the Wine stddef.h has this:
/* Best to leave this one alone: wchar_t */
and doesn't define it.
So if you include the normal stddef.h, we have a definition. This can be
done with a -I- to indicate that only "" style headers should be included
from the given directories:
gcc -fshort-wchar -I /home/dimi/dev/wine/wine.src/include/msvcrt -I /home/dimi/dev/wine/wine.src/include -I- test.c
The problem is, there is a conflict between linux stddef.h and wine stdlib.h. There is also a
redifinition of size_t in stdio.h, but that's not a problem.
So the following C program compiles fine with the above command, -fshort-wchar or not, and making
stdio.h angle-bracketed will take away the size_t warning:
Obviously something could be done about the conflicts and or lack of wchar_t in wine stdlib.h,
but I'll leave that up to someone else...
More information about the wine-devel