3

I have created simple c++ application program in raspberry Pi. I could build this code in raspberry pi, but I'm getting error while compiling it in my labtop "ubuntu".

My aim is to create executable in desktop and then use that executable in raspberry pi.

    #include <iostream>
    #include <vector>
    #include <unordered_map>
    #include <string>
    #include <fstream>
    #include <wiringPi.h> 

Error is :

In file included from src/config_loader/configloader.cpp:3:
include/config.h:8:10: fatal error: wiringPi.h: No such file or directory
    8 | #include <wiringPi.h>
      |          ^~~~~~~~~~~~
compilation terminated.
In file included from include/move.h:3,
                 from src/move/movement.cpp:1:
include/config.h:8:10: fatal error: wiringPi.h: No such file or directory
    8 | #include <wiringPi.h>
2

1 Answer 1

3

There are two issues here:

First: Your problem comes from missing headers. You would need to figure out which packages contain the headers and install them on your desktop computer. As the packages have a different architecture, you would probably need to unpack them manually or re-build the packages for your PC architecture (usually amd64) first.

Second: As your desktop has a different architecture, the problem exists in the other direction as well. When you successfully compiled the program on your desktop PC, it will have the wrong architecture for the pi. So you need a "cross compiler" toolchain to do so. This is not that easy to setup and may justify another question (First have a look if there is an existing one).

A possible alternative to cross compilers is to use a VM with ARM architecture that can boot a raspberry pi image. For example qemu can emulate ARM, but the exact details aren't that easy either.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.