How do I include libraries in code::blocks / ubuntu

Discussion about everything. New games, 3d math, development tips...
Post Reply
nathanf534
Posts: 199
Joined: Tue Dec 09, 2008 2:55 am

How do I include libraries in code::blocks / ubuntu

Post by nathanf534 »

Although this has nothing to do with irrlicht, I know many of you use linux/code::blocks so hopefully you can help me. I am new to Ubuntu and am getting an error when I try to include a library

Code: Select all




-------------- Build: Debug in test ---------------

g++ -Wall -fexceptions  -g     -c /home/nathan/test/main.cpp -o obj/Debug/main.o
g++ -L/usr/lib  -o bin/Debug/test obj/Debug/main.o    file:///usr/lib/libpcap.a 
g++: file:///usr/lib/libpcap.a: No such file or directory
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings
 

 

I selected the library file from code::blocks, so there shouldn't be a typo in the path, and when I click on the file, in properties it says it is at "/usr/lib"

any suggestions?
while(signatureEmpty){cout<<wittyComment();}
conallmmcg
Posts: 23
Joined: Sun Oct 19, 2008 2:35 pm

Post by conallmmcg »

well in my experience you wouldn't include the full directory including the lib file, like /usr/lib/libpcap.a
usually you would include in your settings->compiler->search directories->linker, /usr/lib and /usr/local/lib
( this will find most libraries needed) , or any other specific folder needed.
and in your project build options under linker settings-> link libraries
add in the libs you need to link against without the "lib" or ".a" or ".so"
for eg: libpcap.a would be added in as just pcap.

hope this helps
nathanf534
Posts: 199
Joined: Tue Dec 09, 2008 2:55 am

Post by nathanf534 »

add in the libs you need to link against without the "lib" or ".a" or ".so"
Thanks, thats what was wrong.
while(signatureEmpty){cout<<wittyComment();}
Post Reply