markondej / fm_transmitter

Raspberry Pi as FM transmitter
1.32k stars 292 forks source link

Make error std::runtime_error #196

Closed La-chocolatine-FR closed 2 months ago

La-chocolatine-FR commented 3 months ago

pain@pain-desktop:~/fm_transmitter$ sudo make GPIO21=1 g++ -Wall -O3 -std=c++11 -fno-strict-aliasing -I/opt/vc/include -DGPIO21 -c transmitter.cpp transmitter.cpp: In constructor ‘Peripherals::Peripherals()’: transmitter.cpp:172:28: error: ‘runtime_error’ is not a member of ‘std’ 172 | throw std::runtime_error("Cannot open /dev/mem file (permission denied)"); | ^~~~~ transmitter.cpp:42:1: note: ‘std::runtime_error’ is defined in header ‘’; did you forget to ‘#include ’? 41 | #include <sys/mman.h> +++ |+#include 42 | transmitter.cpp:178:28: error: ‘runtime_error’ is not a member of ‘std’ 178 | throw std::runtime_error("Cannot obtain access to peripherals (mmap error)"); | ^~~~~ transmitter.cpp:178:28: note: ‘std::runtime_error’ is defined in header ‘’; did you forget to ‘#include ’? transmitter.cpp: In constructor ‘AllocatedMemory::AllocatedMemory(unsigned int)’: transmitter.cpp:206:28: error: ‘runtime_error’ is not a member of ‘std’ 206 | throw std::runtime_error("Cannot allocate memory (" + std::to_string(size) + " bytes)"); | ^~~~~ transmitter.cpp:206:28: note: ‘std::runtime_error’ is defined in header ‘’; did you forget to ‘#include ’? transmitter.cpp: In member function ‘void Transmitter::TxViaDma(WaveReader&, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int)’: transmitter.cpp:412:20: error: ‘runtime_error’ is not a member of ‘std’ 412 | throw std::runtime_error("DMA channel number out of range (0 - 15)"); | ^~~~~ transmitter.cpp:412:20: note: ‘std::runtime_error’ is defined in header ‘’; did you forget to ‘#include ’? transmitter.cpp: In member function ‘void Transmitter::TxViaCpu(WaveReader&, unsigned int, unsigned int, unsigned int, unsigned int)’: transmitter.cpp:529:28: error: ‘runtime_error’ is not a member of ‘std’ 529 | throw std::runtime_error("Transmitter thread has unexpectedly exited"); | ^~~~~ transmitter.cpp:529:28: note: ‘std::runtime_error’ is defined in header ‘’; did you forget to ‘#include ’? make: *** [makefile:19: transmitter.o] Error 1 pain@pain-desktop:~/fm_transmitter$

La-chocolatine-FR commented 3 months ago

In the file transmitter.cpp add it is the statement : #include<stdexcept> and #include<iostream>