BeagleBone Black + BlackLib- 程序 + 库编译

BeagleBone Black + BlackLib- program+library compilation

本文关键字:编译 程序 BlackLib- Black BeagleBone      更新时间:2023-10-16

我需要用我的程序编译库(只是main.cpp)。该库是BlackLib 2.0(已经有如何编译blacklib(c ++),但我无法重现结果...也许我误解了什么)。

无论如何,3个要点:

1) 主要.cpp包括:

#include <iostream>
#include <unistd.h>
#include <BlackCore.h>
#include <BlackDef.h>
#include <BlackErr.h>
#include <BlackLib.h>
#include <BlackUART.h>

2) 所有文件(库文件 - .cpp & .h ...和 main.cpp) 位于 1 个文件夹中:

/home/martin/uart/uart_5#

3)编译文件的命令(直接在BeagleBone Black上)

g++ *.cpp -o main -std=c++11

问题:

BlackI2C.cpp: In member function 'bool BlackLib::BlackI2C::close()':
BlackI2C.cpp:133:13: error: '::close' has not been declared
BlackI2C.cpp: In member function 'bool BlackLib::BlackI2C::writeLine(uint8_t*, size_t)':
BlackI2C.cpp:287:13: error: '::write' has not been declared
BlackI2C.cpp: In member function 'bool BlackLib::BlackI2C::readLine(uint8_t*, size_t)':
BlackI2C.cpp:302:13: error: '::read' has not been declared
BlackSPI.cpp: In member function 'bool BlackLib::BlackSPI::close()':
BlackSPI.cpp:213:13: error: '::close' has not been declared
BlackUART.cpp: In member function 'bool BlackLib::BlackUART::close()':
BlackUART.cpp:166:13: error: '::close' has not been declared
BlackUART.cpp: In member function 'bool BlackLib::BlackUART::read(char*, size_t)':
BlackUART.cpp:226:12: error: '::read' has not been declared
BlackUART.cpp: In member function 'std::string BlackLib::BlackUART::read()':
BlackUART.cpp:244:24: error: '::read' has not been declared
BlackUART.cpp: In member function 'bool BlackLib::BlackUART::write(char*, size_t)':
BlackUART.cpp:262:12: error: '::write' has not been declared
BlackUART.cpp: In member function 'bool BlackLib::BlackUART::write(std::string)':
BlackUART.cpp:276:12: error: '::write' has not been declared
BlackUART.cpp: In member function 'bool BlackLib::BlackUART::transfer(char*, char*, size_t, uint32_t)':
BlackUART.cpp:293:12: error: '::write' has not been declared
BlackUART.cpp:303:23: error: 'usleep' was not declared in this scope
BlackUART.cpp:309:12: error: '::read' has not been declared
BlackUART.cpp: In member function 'std::string BlackLib::BlackUART::transfer(std::string, uint32_t)':
BlackUART.cpp:324:12: error: '::write' has not been declared
BlackUART.cpp:334:23: error: 'usleep' was not declared in this scope
BlackUART.cpp:339:24: error: '::read' has not been declared
BlackUART.cpp: In member function 'BlackLib::BlackUART& BlackLib::BlackUART::operator<<(std::string&)':
BlackUART.cpp:960:12: error: '::write' has not been declared
BlackUART.cpp: In member function 'BlackLib::BlackUART& BlackLib::BlackUART::operator>>(std::string&)':
BlackUART.cpp:977:24: error: '::read' has not been declared
main.cpp:4:23: fatal error: BlackCore.h: No such file or directory
compilation terminated.

我有点鄙视。BackLib常见问题解答也无济于事。

我已经发布了如何编译 blacklib (c++) 的答案,标题为完整指南 如何直接在运行埃的 BEAGLEBONE BLACK (rev C) 上编译 BLACKLIB

您需要将头文件 unistd.h 添加到 BlackUART.h