我需要将libexplain
包括到我的项目中来完成某些工作。我安装它,并将头文件libexplain/read.h
添加到我的代码中,迄今为止这么好,编译器没有报告错误。但是,当我用libexplain
提供的功能explain_read()
和建设项目,它说:对`explain_read'的未定义引用......没有这样的文件或目录
/tmp/cc7NjAw0.o: In function `xl45_read(int, unsigned char*)':
connections.cpp:(.text+0x2f): undefined reference to `explain_read'
collect2: error: ld returned 1 exit status
和构建脚本是:
#!/bin/bash
echo > ./stdafx.h
g++ -O1 -Wall -o ./local_proxy (*.cpp...here is the source file list) -lz -lpthread -lpcap -L/usr/local/lib
其实当我输入
whereis libexplain
在终端,我得到
libexplain: /usr/lib/libexplain.so /usr/lib/libexplain.a /usr/include/libexplain
我做了很多搜索,但仍然不知道发生了什么问题。 ):
尝试在构建脚本的“g ++”行末尾添加“-lexplain”。 – TonyB
谢谢你我的朋友,问题解决了@TonyB – xl45