Cross Compiler WiringPi with QT on Linux for RPi3
I want to cross compile WiringPi on QT Creator (ubuntu 16.04). I simply add WiringPi directory to header and source as below:
https://www.dropbox.com/s/s6nj9mu33tul6az/Screenshot from 2017-03-05 22-37-35.png
Here are some information about this project:
- Before adding wiringPi, this project can build successful run on Rpi3.
- After adding wiringPi, it shows a lot error.
- I have not add any code to this project(such as "#include "../wiringpi.h").
Any idea is very appreciate.
Why would you like to cross-compile the WiringPi library? I guess the usual way is to compile WiringPi locally on the Pi, which is quite simple and fast. During cross-compile of your app you just need the header and an additional
LIBS += -lwiringPi
in your pro file. (Assuming proper paths for the system directories of your pi are set in your cross compile environment.)
Check, if you already have WiringPi binaries on your Pi. If yes, you should get something like
pi@raspberrypi:~/deploy $ ldconfig -p | grep wiringPi libwiringPiDev.so (libc6,hard-float) => /usr/local/lib/libwiringPiDev.so libwiringPiDev.so (libc6,hard-float) => /usr/lib/libwiringPiDev.so libwiringPi.so (libc6,hard-float) => /usr/local/lib/libwiringPi.so libwiringPi.so (libc6,hard-float) => /usr/lib/libwiringPi.so
Then make sure, that these libraries are also visible in the Pi root file system on your development machine.