Consider a simple header file like:
echo "extern int test;" > test.h
For generating a precompiled header, I find both methods below to work:
gcc -c test.h
gcc test.h
If, however, I happen to use a linker flag on the command line:
gcc -Wl,-s -c test.h
gcc -Wl,-s test.h
then, the first method works, but the second one (without -c) gives the
following error:
/usr/lib/gcc/i486-linux-gnu/4.4.1/../../../../lib/crt1.o: In function
`_start':
/build/buildd/eglibc-2.10.1/csu/../sysdeps/i386/elf/start.S:115:
undefined reference to `main'
collect2: ld returned 1 exit status
Is this supposed to work?
gcc --version
gcc (Ubuntu 4.4.1-4ubuntu9) 4.4.1
Cesar