【发布时间】:2012-04-06 11:13:33
【问题描述】:
所以我在 OSX Lion 上试用了这个 bigint 库:https://mattmccutchen.net/bigint/。
我尝试使用他们网站上的示例制作一个简单的文件。
#include <iostream>
#include <bigint/BigIntegerLibrary.hh>
using namespace std;
int main(){
BigInteger a;
int b=5;
a=b;
cout<<a;
return 0;
}
当我在 textmate 中编译时,输出是:
Undefined symbols for architecture x86_64:
"BigInteger::BigInteger(int)", referenced from:
_main in ccl9yNN5.o
"BigInteger::operator=(BigInteger const&)", referenced from:
_main in ccl9yNN5.o
"operator<<(std::basic_ostream<char, std::char_traits<char> >&, BigInteger const&)", referenced from:
_main in ccl9yNN5.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
谁能告诉我怎么回事?
【问题讨论】:
-
是否有与标题一起使用的库?如果是这样,您是否在构建中安装并链接了它?
-
我之前没有使用过任何外部库,所以我不太清楚你在说什么......
-
这是一个截图,如果有帮助的话。 cl.ly/2K472I0i2k0h3w2I2d3E
-
您需要在链接器命令中指定库 .lib 文件。或者您可能只是未能编译 bigint 库的源代码。这完全取决于您希望如何链接到此代码。文档是怎么说的?
-
文件夹中没有任何 .lib 文件。