News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

Linking and using other libs

Started by JessH, July 29, 2010, 10:21:46 AM

Previous topic - Next topic

JessH

Hi guys I'm new to c++ programming and after a few days trying different IDEs I've chosen C::B.

I have been writing some simple stuff and it was all ok until i needed to use some other libraries. I guess it has to do with setting the path or something like that. I tried this :

http://wiki.codeblocks.org/index.php?title=FAQ#Q:_I_would_like_to_compile_a_project_using_some_non-standard_libraries._How_can_I_indicate_to_CodeBlocks_that_these_libraries_and_include_files_exist.3F

but it doesn't seem to work. I did that and added a lot of folders, I even tried with adding all the folders in the tree one by one, but when I try to compile my program C::B doesn't find the functions that I call. The error says "undefined reference to XXfuncion ".

I also tried searching in the forum but I got nothing :( , I hope I posted this in the right place and wish you can help me ^^

Edit :I'm using suse and C::B 10.05 (Debugger 0.3 compiler 0.99)

Jenna

Did you also add the librar(y)(ies) to the "Link libraries:" in the projects/targets "Linker settings" ?

JessH

I can't find that option. If you mean settings>debugger and compiler>linker settings tab , yes I did.

I'm trying to fin that projects/target option now ...

Jenna

"Project -> Build options -> Linker settings -> Link libraries"

JessH

OK I found it thanks. It was empty. Though I don't have a .a .so .lib or so to add , I installed the library from source  and I got the .cpp .hpp .o ... is there any other way ?

In Konsole when I g++ specifying -l and the library name it works fine

JessH

Still doesn't work ... any other idea ?  :(

JessH

Thanks for the help ....

Anyway i solved this :

Settings > Compiler and debugger > global compiler settings > linker settings
In 'link libraries' press 'add' and type the name of the library , in my case it was curl and curlpp.

stahta01

Quote from: JessH on August 04, 2010, 09:02:49 AM
Thanks for the help ....

Anyway i solved this :

Settings > Compiler and debugger > global compiler settings > linker settings
In 'link libraries' press 'add' and type the name of the library , in my case it was curl and curlpp.

The above is an example of the wrong way to do things; sometimes in the future this person
will asked us why is the libraries curl and curlpp always being linked in my new projects.

Tim S.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

JessH

Hi Tim, if that is the wrong way to do it why don't you show me the right one ? I posted several times that jens' solution didn't work and still got no help. So please if you know the answer post it for future users and stop being so overbearing  :wink: no offence

oBFusCATed

(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Jenna

If you do not have a project, my solution will not work, and using the global compiler settings is all you can do, even if it will probably lead to errors later as Tim wrote.

My solution does exactly the same as using global settings, that are common to all projects and files, but on project level.