A question about the -c option

Ricardo Colon rcolon@andrew.cmu.edu
Wed Oct 25 14:05:00 GMT 2000


Does anyone know how to do the following.

I have a test.c file with no main function. It just has methods. 

What I want to do is to compile an object file(i.e. test.o) from this
code.

Apparently -c means compile, but don't link at all.

Unfortunately, my source code uses function from a shared library, which
means that I need to link.

Anyone know how to do this? I want a test.o file. Having a main method
would cause the resulting file to be a.out executable(which is not what I 
want).

However, leaving out the main method, gives me an
"/usr/lib/crt1.o undefined reference to main" error. I'm using Redhat 6.2,
which comes with egcs-2.91.66

Any ideas?

Thanks.



More information about the Gcc-help mailing list