The well known Hello-World program will not link when I set include path.
What do I do wrong ?
int main ( int argc, char** argv)
fprintf( stderr, "Hello, World!\n" );
$ mingw32-gcc hello.c
$ mingw32-gcc hello.c -I/usr/include
/tmp/cco6QboP.o:hello.c:(.text+0x33): undefined reference to `_stderr'
collect2: ld returned 1 exit status
$ mingw32-gcc --version
mingw32-gcc (GCC) 3.4.2 (mingw-special)
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
From: Keith MARSHALL <keith.marshall@to...> - 2007-04-27 11:14:24
Jesper Quorning wrote:
> The well known Hello-World program will not link when I set
> include path. What do I do wrong ?
> $ mingw32-gcc hello.c
> $ mingw32-gcc hello.c -I/usr/include
> /tmp/cco6QboP.o:hello.c:(.text+0x33): undefined reference to `_stderr'
> collect2: ld returned 1 exit status
A standard MinGW installation has its headers in /mingw/include.
I'm guessing you've got a foreign stdio.h in /usr/include, and by
overriding the default header, (your -I... path is searched first,
so the search stops at the incompatible stdio.h there), you've
generated a bad reference -- in this case it's an improper
declaration for the `FILE stderr' reference.