On 06/10/2010 04:18 AM, Keith MARSHALL wrote: > > > 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. >
hi Keith thank you very much for pointing out the orders. I definitely overlooked the issue. After putting -lgw32c -lole32 at the end of the command line, the linking error for drand48_r has gone. However, there are still 10s of unresolved references error for stderr, stdin and stdout. Are there anything else I overlooked? > Also, .obj looks wrong for GCC; while the format may be correct, .o > is the more normal object file extension. > I deliberately set it to .obj for windows, although setting it to .o shall be equally ok. OBJSUFFIX := .o BINSUFFIX := ARCH = $(shell uname -m) PLATFORM = $(shell uname -s) ifeq ($(findstring MINGW32,$(PLATFORM)), MINGW32) ... OBJSUFFIX=.obj BINSUFFIX=.exe endif Qianqian > > -- > 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 _______________________________________________ GnuWin32-Users mailing list GnuWin32-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gnuwin32-users