【发布时间】:2011-10-28 01:16:45
【问题描述】:
我正在学习 c++,我正在尝试在我的程序中使用从 Internet 下载的库(从这里 https://mattmccutchen.net/bigint/)。 因为我希望一切都非常整洁,所以我将所有 .hh 文件放在一个名为“BI”的子文件夹中。 但是,当我尝试使用 g++(在 Windows XP SP3 上是 MinGW)编译我的 .cpp 文件时,编译器会输出以下错误:
J:\comp proj\FS>J:\Programmi\MinGW\bin\g++.exe "J:\comp proj\FS\test.cpp" -o "J:\comp proj\FS\test.exe" -I "J:\comp proj\FS\BI"
E:\DOCUME~1\MrJackV\IMPOST~1\Temp\ccidH1Z6.o:test.cpp:(.text+0x2c): undefined reference to BigInteger::BigInteger(int)'
E:\DOCUME~1\MrJackV\IMPOST~1\Temp\ccidH1Z6.o:test.cpp:(.text+0x11b): undefined reference tooperator<<(std::ostream&, BigInteger const&)'
E:\DOCUME~1\MrJackV\IMPOST~1\Temp\ccidH1Z6.o:test.cpp:(.text$ZNK10BigIntegermlERKS[BigInteger::operator*(BigInteger const&) const]+0x29): undefined reference
to `BigInteger::multiply(BigInteger const&, BigInteger const&)'
collect2: ld returned 1 exit status
我尝试使用-I, -l and -L 开关来解决问题,但没有成功。
此外,我尝试在 cpp 中输入#include "BI/BigIntegerLibrary.hh",但没有成功。
是不是我做错了什么?
提前致谢。
【问题讨论】: