Skip to content

Instantly share code, notes, and snippets.

@sol-prog
Last active March 20, 2024 14:32
Show Gist options
  • Star 11 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save sol-prog/95e4e7e3674ac819179acf33172de8a9 to your computer and use it in GitHub Desktop.
Save sol-prog/95e4e7e3674ac819179acf33172de8a9 to your computer and use it in GitHub Desktop.
Install GCC 9 on Raspberry Pi and build C++17 programs
# 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
// 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';
}
}
@bo100nka
Copy link

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