Last active
March 20, 2024 14:32
-
-
Save sol-prog/95e4e7e3674ac819179acf33172de8a9 to your computer and use it in GitHub Desktop.
Install GCC 9 on Raspberry Pi and build C++17 programs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Commands used in the video https://youtu.be/-bCG87jBDqA : | |
sudo apt update && sudo apt upgrade -y | |
git clone https://bitbucket.org/sol_prog/raspberry-pi-gcc-binary.git | |
cd raspberry-pi-gcc-binary | |
tar -xjvf gcc-9.1.0-armhf-raspbian.tar.bz2 | |
sudo mv gcc-9.1.0 /opt | |
cd .. | |
rm -rf raspberry-pi-gcc-binary | |
cd ~ | |
echo 'export PATH=/opt/gcc-9.1.0/bin:$PATH' >> ~/.bashrc | |
echo 'export LD_LIBRARY_PATH=/opt/gcc-9.1.0/lib:$LD_LIBRARY_PATH' >> ~/.bashrc | |
. ~/.bashrc | |
sudo ln -s /usr/include/arm-linux-gnueabihf/sys /usr/include/sys | |
sudo ln -s /usr/include/arm-linux-gnueabihf/bits /usr/include/bits | |
sudo ln -s /usr/include/arm-linux-gnueabihf/gnu /usr/include/gnu | |
sudo ln -s /usr/include/arm-linux-gnueabihf/asm /usr/include/asm | |
sudo ln -s /usr/lib/arm-linux-gnueabihf/crti.o /usr/lib/crti.o | |
sudo ln -s /usr/lib/arm-linux-gnueabihf/crt1.o /usr/lib/crt1.o | |
sudo ln -s /usr/lib/arm-linux-gnueabihf/crtn.o /usr/lib/crtn.o | |
g++-9.1 -std=c++17 -Wall -pedantic test_fs.cpp -o test_fs | |
./test_fs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Build/compile with: | |
// g++-9.1 -std=c++17 -Wall -pedantic test_fs.cpp -o test_fs | |
#include <iostream> | |
#include <filesystem> | |
int main() { | |
for(auto &file : std::filesystem::recursive_directory_iterator("./")) { | |
std::cout << file.path() << '\n'; | |
} | |
} |
yes, this resolved the problem for me too, thanks a lot
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
same error here, I tried search those header files, found them under
so I copied them to
include
sudo cp /usr/include/arm-linux-gnueabihf/sys/* /usr/include/sys/
done