Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4495

C/C++ • How to Cross Compile a C++ Program on Ubuntu for 32-bit PiOS on Raspberry Pi 2B?

$
0
0
I have an old Raspberry Pi 2B running the latest 32-bit PiOS named

Code:

Linux raspberrypi 6.6.31+rpt-rpi-v6 #1 Raspbian 1:6.6.31-1+rpt1 (2024-05-29) armv6l GNU/Linux
. I want to cross compile C++ code for it on my development machine running Ubuntu 18.04.
When I compile helloworld.cpp with arm-linux-gnueabihf-g++, I get a binary program a.out. However, when I run it on the device, it throws a Segmentation fault error.
I guess arm-linux-gnueabihf is not suitable for Raspberry Pi 2B. So, which version of g++ should I install on Ubuntu?

Statistics: Posted by tocky77 — Mon Aug 05, 2024 7:07 am — Replies 0 — Views 13



Viewing all articles
Browse latest Browse all 4495

Trending Articles