Author Topic: Add wiringPi library for my console project in CodeBlocks in Rapabian..  (Read 13515 times)

Offline DigitalSpinner

  • Single posting newcomer
  • *
  • Posts: 2
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: [Select]
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)

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6510
    • My Best Post
« Last Edit: February 22, 2014, 03:30:27 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline DigitalSpinner

  • Single posting newcomer
  • *
  • Posts: 2
Re: Add wiringPi library for my console project in CodeBlocks in Rapabian..
« Reply #2 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!