On Sun, Dec 18, 2011 at 2:49 PM, Keith Marshall <keithmarshall@users.sourceforge.net> wrote:
Not attempting to quote from unintelligibly top-posted thread;
this relates to ordering of object file and library references on
gcc command line.

On 18/12/11 07:06, Sultan Saini wrote:
> By the way, is this a known issue with MinGW gcc?

Yes, and no.  Yes, the issue is well known; so well known that it
is the subject of a FAQ:

http://www.mingw.org/wiki/The_linker_consistently_giving_undefined_references

However, the issue is NOT a MinGW gcc fault; it is user error.

> Seems odd that the order of arguments to the compiler should cause
> a problem like this.

Not at all.  It is standard behaviour for *nix linkers.  Object file and
library references are read in strictly left to right order, and symbols
from libraries are only selected for inclusion in the output image if
they have already been identified as needed, by reference in another
file which has been read BEFORE the library itself is read.

Thanks for the explanation, Keith, and once again, my apologies for the top posting.

Even using mingw32-gcc, putting the object files before the library options did not fix my problem, but switching to g++ did.

I should start a new thread, given that the nature of my problem has changed.

-sultan