我需要用我的程序(只是main.cpp)编译库。该库是BlackLib 2.0(已经有how to compile blacklib (c++),但我无法重现结果......也许我误解了一些内容。)
无论如何,有三个要点:
1)main.cpp包括:
#include <iostream>
#include <unistd.h>
#include <BlackCore.h>
#include <BlackDef.h>
#include <BlackErr.h>
#include <BlackLib.h>
#include <BlackUART.h>
2)所有文件(库文件 - .cpp&amp; .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 FAQ也没有帮助。
答案 0 :(得分:0)
我已将how to compile blacklib (c++)的答案发布在标题完整指南中如何直接在运行ANGSTROM的BEAGLEBONE BLACK(rev C)上编译BLACKLIB
答案 1 :(得分:0)
您需要将头文件unistd.h添加到BlackUART.h