我是C ++的新手,但存在以下问题:
文件:-main.cpp-utils.h-utils.cpp
当我在做:
g ++ -c -std = c ++ 11 utils.cpp(编译)g ++ -c -std = c ++ 11 utils.cpp(编译)
当我尝试链接时:
g ++ -o main.o utils.o
/usr/lib/gcc/i686-redhat-linux/4.8.3/../../../crt1.o:在
_start': (.text+0x18): undefined reference to
main函数中utils.o:在clean_html(std::string const&)': utils.cpp:(.text+0xfa): undefined reference to
tidyCreate函数中utils.cpp :(。text + 0x118):未定义对tidyOptSetBool' utils.cpp:(.text+0x13b): undefined reference to
tidyOptSetBool的utils.cpp :(。text + 0x15e):未定义对tidyOptSetBool' utils.cpp:(.text+0x181): undefined reference to
tidyOptSetBool的utils.cpp :(。text + 0x1a4):未定义对tidyOptSetBool' utils.cpp:(.text+0x1c7): undefined reference to
tidyOptSetBool的utils.cpp :(。text + 0x1ea) :对tidyOptSetValue' utils.cpp:(.text+0x209): undefined reference to
tidyOptSetBool的utils.cpp的未定义引用:(.text + 0x228):对tidyOptSetBool' utils.cpp:(.text+0x247): undefined reference to
tidyOptSetInt的utils.cpp的未定义引用:(.text + 0x281):对tidyParseString' utils.cpp:(.text+0x295): undefined reference to
tidyCleanAndRepair的utils.cpp的未定义引用:(.text + 0x2b0):未定义引用tidySaveBuffer' utils.cpp:(.text+0x322): undefined reference to
tidyBufFree'utils.cpp :(。text + 0x32d):未定义引用`tidyRelease'collect2:错误:ld返回1退出状态
在utils.cpp中,我有一个函数clean_html。当我删除此功能时,代码将成功链接。
我正在使用gcc版本4.8.3 20140911(Red Hat 4.8.3-7)(GCC)。
通过fedora存储库使用以下方式安装Tidy:已安装软件包libtidy-devel-0.99.0-28.20091203.fc19.i686和最新版本已安装软件包libtidy-0.99.0-28.20091203.fc19.i686和最新版本
编辑:
忘了提及:-我使用#include包含tidy.h
tidy.h位于/usr/include/tidy.h
您需要添加-ltidy
到链接命令。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句