Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: ASJ on February 21, 2006, 10:59:34 pm

Title: rev. 2056: linking libraries from global compiler options (bug?)
Post by: ASJ on February 21, 2006, 10:59:34 pm
In rev. 2056 under Linux, there is a small change in how libraries should be specified:
the "-l" has to be prepended to the library name because it is not prepended automatically in the compiler line.

Could this be a small bug?
Title: Re: rev. 2056: linking libraries from global compiler options (bug?)
Post by: mandrav on February 21, 2006, 11:02:17 pm
I can't confirm this...
What's the library's name?
Title: Re: rev. 2056: linking libraries from global compiler options (bug?)
Post by: ASJ on February 22, 2006, 01:54:07 pm
It is independent of the specific library (I tried it with more then 10 different libraries that are all in the searchpath).
For example the library libMagick.a (an ImageMagick library), the output of the compiler is shown below from the case that I just enter Magick in the "link library" list in the global compiler settings:
Code
g++ -L/usr/lib -L/usr/local/lib -L/usr/lib -L/home/sjaak/Projects/fobs-src/lib -L/usr/local/lib  -o wxSmith_project .objs/app.o .objs/mainframe.o   `wx-config --libs` `wx-config --unicode=yes --debug=no --libs`  Magick 
g++: Magick: Onbekend bestand of map
Process terminated with status 1 (0 minutes, 24 seconds)
and no executable was linked.
When I looked carefully I thought the -l was missing. So when I entered -lMagick in the "link library" list I got the following compiler output:
Code
g++ -L/usr/lib -L/usr/local/lib -L/usr/lib -L/home/sjaak/Projects/fobs-src/lib -L/usr/local/lib  -o wxSmith_project .objs/app.o .objs/mainframe.o   `wx-config --libs` `wx-config --unicode=yes --debug=no --libs`  -lMagick 
Process terminated with status 0 (1 minutes, 21 seconds)
and a executable was created without problems.

Maybe to complete my previous message, I am running revision 2056 on a SuSE 10 system.
Title: Re: rev. 2056: linking libraries from global compiler options (bug?)
Post by: mandrav on February 22, 2006, 02:13:23 pm
Are you sure you 're adding "Magick" in the "Link libraries" box (at the left) and not in "Other options"?

Go to "Settings->Compiler->Other", click "Advanced options" and verify the settings in the "Others" page. Specifically, verify that the "Link library" box contains -l (that's a lower L)...
Title: Re: rev. 2056: linking libraries from global compiler options (bug?)
Post by: ASJ on February 22, 2006, 03:16:43 pm
I double checked, and I am indeed adding to the "Link Libraries box" at the left. Also the "Link Library" option on the "Others" page was set at -l (as it should be).
By double checking and testing I came across the following:

Title: Re: rev. 2056: linking libraries from global compiler options (bug?)
Post by: mandrav on February 22, 2006, 03:20:05 pm
Quote
Choosing Settings->Environment makes CodeBlocks crash immediately

If you 're building using autotools (configure and friends), after running svn update to get the newest version, run "make clean-zipfiles" before invoking the usual build procedure.
It seems that the resource zips are not recreated automatically.
In other words, it crashes because the code references a widget in the dialog that is not present in your installed zip resources.
Title: Re: rev. 2056: linking libraries from global compiler options (bug?)
Post by: ASJ on February 22, 2006, 05:25:02 pm
I compiled the latest revision (2061) with this tip, and indeed the crash is gone now.

However, I still have to enter "-lMagick" in the "Link Libraries" box to make the linking succeed.....