我正在運行一個beaglebone並希望編寫一個程序來對ADC進行採樣。我試圖從這裏使用blacklib(http://blacklib.yigityuce.com/index.html)。我克隆的git: https://github.com/yigityuce/BlackLib如何編譯blacklib(C++)
,並試圖編譯
g++ exampleAndTiming.cpp -std=c++11
的例子然而,這給了我這樣的一噸的錯誤:
In file included from exampleAndTiming.cpp:33:0:
exampleAndTiming/exampleAndTiming_GPIO.h: In function 'void exampleAndTiming_GPIO()':
exampleAndTiming/exampleAndTiming_GPIO.h:97:12: error: 'sleep' was not declared in this scope
sleep(1);
^
In file included from exampleAndTiming.cpp:34:0:
exampleAndTiming/exampleAndTiming_ADC.h: In function 'void exampleAndTiming_ADC()':
exampleAndTiming/exampleAndTiming_ADC.h:67:16: error: 'usleep' was not declared in this scope
usleep(1000);
^
所以我包括unistd.h中(在exampleAndTiming.cpp中),但然後我得到這樣的錯誤:
/tmp/ccbgiXE9.o: In function `exampleAndTiming_GPIO()':
exampleAndTiming.cpp:(.text+0x50): undefined reference to `Timing::startMeasure(std::string)'
exampleAndTiming.cpp:(.text+0x80): undefined reference to `BlackLib::BlackGPIO::BlackGPIO(BlackLib::gpioName, BlackLib::direction, BlackLib::workingMode)'
exampleAndTiming.cpp:(.text+0xbc): undefined reference to `Timing::endMeasure(std::string)'
exampleAndTiming.cpp:(.text+0xec): undefined reference to `BlackLib::BlackGPIO::BlackGPIO(BlackLib::gpioName, BlackLib::direction, BlackLib::workingMode)'
exampleAndTiming.cpp:(.text+0x104): undefined reference to `BlackLib::BlackGPIO::BlackGPIO(BlackLib::gpioName, BlackLib::direction, BlackLib::workingMode)'
exampleAndTiming.cpp:(.text+0x11c): undefined reference to `BlackLib::BlackGPIO::BlackGPIO(BlackLib::gpioName, BlackLib::direction, BlackLib::workingMode)'
exampleAndTiming.cpp:(.text+0x158): undefined reference to `Timing::startMeasure(std::string)'
我一直在看一些庫例子,並編譯它,但我無法理解這一切。我已經編譯了大量的C++和c程序,但我無法得到這個工作。所以任何幫助將不勝感激。
這將是一個有益的另外的連接,再加上一個示例項目很可能是最好的。雖然我確實恢復了libpruio,因爲blacklib不使用PRU,出於某種原因,獲取ADC值的速度更慢,然後只需從文件系統讀取相關文件(每秒讀取130次,讀取所有ADC通道80次)。 – tomzooi