News:

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

Main Menu

Problems with WirinigPi and CodeBlocks

Started by nobbody, July 06, 2023, 04:58:16 PM

Previous topic - Next topic

nobbody

Hello everyone, I would like to switch a GPIO port on and off using two buttons. However, it only recognizes the functions of the wiringPi.h header when programming. He already suggests the corresponding functions. If I then want to compile the whole thing, the error message "undefined reference to pinMode" comes up. In an example program with Qt, the problem was solved with the following lines in the project file: LIBS += -L/usr/local/include -lwiringPi
I also tried adding the swritch -lwiringPi under Settings->OtherCompilerOptions but it didn't work. Although the build log looks fine.
gcc -pthread -I/usr/include/gtk-2.0 -I/usr/lib/arm-linux-gnueabihf/gtk-2.0/include -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/arm-linux-gnueabihf/glib-2.0/include -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -Wall -O2 -lwiringPi  -c /home/andreas/GPIOTest/MeinErstesProjekt/main.c -o obj/Release/main.o
gcc  -o bin/Release/MeinErstesProjekt obj/Release/main.o  -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lharfbuzz -lfontconfig -lfreetype -s 
My configurations:
Raspberry Pi 4B
WiringPi Version 2.52
CodeBlocks Version 20.03

Miguel Gimenez

The wiringPi library must be added in the linker tab, not in the compiler one.

nobbody