Hi
I have a CPP app which I have recently ported to the Beaglebone Black.
I have my serial ports working and a DS1307 RTC on i2c1 working.
The last hurdle is driving GPIO.
I have read a few articles / solution for GPIO access but would like to know what is the current best practice for this.
I have tried the following:
This works but is a little heavy for my needs as I just want simple GPIO input and output. Also it must run as superuser
This looks a lot lighter and better suited to my needs, but I can’t get it to link. eg
debian@beaglebone:~/supervisor/src$ g++ -std=c++17 -lstdc++fs gpio/*.cpp gpio/*.h main.cpp -o example
/usr/bin/ld: /tmp/ccUoHgBs.o: in function `beagle::gpio::GPIOManager::GPIOManager()':
manager.cpp:(.text+0x138): undefined reference to `std::filesystem::__cxx11::directory_iterator::operator*() const'
/usr/bin/ld: manager.cpp:(.text+0x20c): undefined reference to `std::filesystem::__cxx11::directory_iterator::operator++()'
/usr/bin/ld: /tmp/ccUoHgBs.o: in function `std::filesystem::__cxx11::directory_iterator::directory_iterator(std::filesystem::__cxx11::path const&)':
manager.cpp:(.text._ZNSt10filesystem7__cxx1118directory_iteratorC2ERKNS0_4pathE[_ZNSt10filesystem7__cxx1118directory_iteratorC5ERKNS0_4pathE]+0x12): undefined reference to `std::filesystem::__cxx11::directory_iterator::directory_iterator(std::filesystem::__cxx11::path const&, std::filesystem::directory_options, std::error_code*)'
/usr/bin/ld: /tmp/ccUoHgBs.o: in function `std::filesystem::__cxx11::path::path<char [16], std::filesystem::__cxx11::path>(char const (&) [16], std::filesystem::__cxx11::path::format)':
manager.cpp:(.text._ZNSt10filesystem7__cxx114pathC2IA16_cS1_EERKT_NS1_6formatE[_ZNSt10filesystem7__cxx114pathC5IA16_cS1_EERKT_NS1_6formatE]+0x3a): undefined reference to `std::filesystem::__cxx11::path::_M_split_cmpts()'
collect2: error: ld returned 1 exit status
Thanks for your help.