This is the mail archive of the mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: undefined reference to '_...

Hallo Hans,

Am Sonntag, 8. Juni 2003 um 19:22 schriebst du:

> Hi folks,

> I'm trying to port a collection of unix applications to cygwin, and in doing
> so, I'm having a hard time to get the stuff to link.
> It's a bunch of fortran and c sources, that call each other wildly. some
> mains are in c, some mains are in fortran.

> Compiling and archiving everything works like a charm,

> When I'm trying to link the first executable (main in c) against the
> libraries I have created, I get tons of undefined reference complaints, all
> starting with '_', and all are non-system symbols.
> I've confirmed by running nm on the libraries in question, that the missing
> symbols are actually in the library.

> The linker command is :
> gcc -ofoo foomain.o -L../lib -lfoo1 -lfoo2 -lg2c -lc -lgsl -lm

> Do I have to do something special to a libraries after archival of object
> files, before I can link against it?

> I'm probably doing something very stupid.
> But since my head is already hurting from banging it against the concrete
> wall for a while, I'd rather ask.

> anybody any clues?

It is not neccessary to link against libc and libm since they are the
same as libcygwin (sysmlinks) and libcygwin is linked in
automatically.  Then it depends on the order.  If libfoo1 needs a
symbol from libfoo2 the linker doesn't find it (or was it the other
way around?), try:
 gcc -o foo foomain.o -L../lib -lgsl -lg2c -lfoo2 -lfoo1
or other combinations since the order is important for the linker.


Unsubscribe info:
Problem reports:

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