User forums > Using Code::Blocks
build with libxxx library.
(1/1)
readon:
when i include libxml library in my project.
i find that, after typing libxml2 in "project build option-> link setting -> link libraries"
the ld.exe would report error cannot find -lxml2. notice that lib was cutted automatically.
i tried many times, there are two ways to solve that.
1.rename the libxml2.lib file to xml2.lib.(path has already added to search directories)
2.type in full path of libxml2.lib.(this is not suitable for multi-developer case.)
above methods are not good enough.
how to solve this in a elegant way? is it a bug?
MortenMacFly:
--- Quote from: readon on March 04, 2010, 09:18:52 am ---how to solve this in a elegant way?
--- End quote ---
Besides providing the name of the library you'll also need to provide the path to the library in the project options -> search directories -> linker.
--- Quote from: readon on March 04, 2010, 09:18:52 am ---is it a bug?
--- End quote ---
No.
A suggestion: First try to compile your file on the command line to understand how am compiler/linker works, then use an IDE.
readon:
I have added the path in search directories-> linker
i think you can try it yourself with cb 8.02 /win32 using libxml2.lib.
i have using gcc & make system in linux.
in linux, prefix lib- and .so would be added automatically.
Seronis:
I think this is related to the fact that libraries are expected to be named lib<name>.a or <name>.lib and NOT lib<name>.lib. I had issues with this myself before and there was some small discussion on it being caused by CB doing some automatic name 'correcting' of what you enter and what it actually sends as the option to the linker. I think a workaround was entering liblib<name>.lib in the cb box to compensate for improper name correcting. I'll see if i can find the old thread...
-edit-
http://forums.codeblocks.org/index.php/topic,11123.0.html
Navigation
[0] Message Index
Go to full version