Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
rev. 2056: linking libraries from global compiler options (bug?)
ASJ:
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?
mandrav:
I can't confirm this...
What's the library's name?
ASJ:
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)
--- End code ---
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)
--- End code ---
and a executable was created without problems.
Maybe to complete my previous message, I am running revision 2056 on a SuSE 10 system.
mandrav:
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)...
ASJ:
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:
* Choosing Settings->Environment makes CodeBlocks crash immediately (after showing something about a debug report)
* it seems that the settings from the "Global Compiler Settings" are not always saved when the dialog is closed. I could however not find any order where it went wrong, so probably it is just me......
Navigation
[0] Message Index
[#] Next page
Go to full version