help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: separate implementation and head files, and make library, get troubl


From: Paul Pluzhnikov
Subject: Re: separate implementation and head files, and make library, get trouble.
Date: 10 Nov 2004 17:04:46 -0800
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Artificial Intelligence)

"Jon Z. Xue" <zhong.xue@ieee.org> writes:

> Hi, help --- what is going one after I make a library and tries to use this
> library in the link stage? See the following two makefiles, the first one
> doens work and the second one works fine.

Read this: http://webpages.charter.net/ppluzhnikov/linker.html

>         g++ -o test -L./ -lxzimage test.o -lstdc++ -O2

The correct command line would be:

         g++ -O2 -o test test.o -L./ -lxzimage 

You should never put libraries before objects (the reason would be
clear once you've read the article cited above), nor should you
ever list -lstdc++ or -lc on the link line (g++ will add necessary
libraries automatically).

Cheers,
-- 
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]