Code::Blocks Forums

User forums => General (but related to Code::Blocks) => Topic started by: DigitalSpinner on February 22, 2014, 11:44:14 am

Title: Add wiringPi library for my console project in CodeBlocks in Rapabian..
Post by: DigitalSpinner on February 22, 2014, 11:44:14 am
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:

Code
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)
Title: Re: Add wiringPi library for my console project in CodeBlocks in Rapabian..
Post by: stahta01 on February 22, 2014, 01:44:36 pm
1. Read the CB Rules.  http://forums.codeblocks.org/index.php/topic,9996.0.html (http://forums.codeblocks.org/index.php/topic,9996.0.html)

2. Read the CB FAQs. http://wiki.codeblocks.org/index.php?title=FAQ (http://wiki.codeblocks.org/index.php?title=FAQ)
3. Read some of the CB User Docs http://wiki.codeblocks.org/index.php?title=User_documentation (http://wiki.codeblocks.org/index.php?title=User_documentation)

Then ask a CB Questions; you should do at least #1 or you will likely be banned from this site.

Edit: The FAQ closest to what I think you are asking is 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 (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)

Tim S.

Title: Re: Add wiringPi library for my console project in CodeBlocks in Rapabian..
Post by: DigitalSpinner on February 24, 2014, 08:24:01 pm
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!