Re: linking error: unresolved symbols drand48_r, stdin and stdout

Keith MARSHALL <[email protected]> Thu, 10 Jun 2010 09:18:26 +0100
Newsgroups gmane.comp.windows.gnu.user
Message-ID <OFD3BD67FA.5A418824-ON8025773E.002C7A08-8025773E.002DA22E@total.com>



> gcc  -lgw32c -lole32 -lm  -o bin/mmc built/posix_randr.obj
> built/simpmesh.obj
> uilt/tettracing.obj built/mcx_utils.obj built/tictoc.obj built/tetray.obj "
>
> I am certain that gcc/ld had found the libgw32c.a that I placed
> under c:\MinGW\lib, but somehow, it does not link :(

It *does* link, and entirely predictably, includes *nothing* from the
libraries in the linked image, because you told the linker to process
all your libraries *before* it had read the objects to build its
requirements list.

This question has been answered about a squillion times on the MinGW
mailing list; the order in which you specifed your link command args
is *wrong*.  The order matters[*], and -l... library specs *must* come
*after* the object files requiring them, (and also in the correct
order so that library interdependencies may be resolved).

[*] FTR,, this command order is just as wrong for compiling on Linux.

Also, .obj looks wrong for GCC; while the format may be correct, .o
is the more normal object file extension.

--
Regards,
Keith.
------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo