This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

A question about the -c option


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]