News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Add wiringPi library for my console project in CodeBlocks in Rapabian..

Started by DigitalSpinner, February 22, 2014, 11:44:14 AM

Previous topic - Next topic

DigitalSpinner

Hi, can anybody help me please with adding wiringPi library issue?

wiringPi installation instructions here: https://projects.drogon.net/raspberry-pi/wiringpi/download-and-install/
wiringPi example here: http://wiringpi.com/examples/blink/

Basically I have managed to complie example as adviced:

gcc -Wall -o blink blink.c -lwiringPi
sudo ./blink


But I would like to use wiringPi library in Code Blocks application.
How I can add this library?

I spend 2 hours searching for clear answer, unfortunately I have no experience with linux development and C++.
I tried to add some searching folders or soo...
I found the wiringPi library is installed in: /usr/local/lib/libwiringPi.so.2.0..
I have wiringPi.h in /home/pi/dev-projects/wiringPi/wiringPi (cloned from GIT)

stahta01

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]

DigitalSpinner

Tim, sorry I'm noob in Linux World.. And Linux hates me..

I finally figured it out thanks to this link you provided: http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#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


So what I done is simple but only when you know what to do.. Maybe useful for others using wiringPi

1/ Start CodeBlocks as root: gksu codeblocks - needed for libwiringPi to be working..
2/ Add the libwiringPi.so in Menu Settings/Compiler and debugger/Linker settings > Link libraries > Add... library found in /usr/lib/libwiringPi.so
3/ Write own code..
4/ Compile, link and run application!