C++中BigInt库的问题

Problems with BigInt Library in C++

本文关键字:问题 BigInt C++      更新时间:2023-10-16

所以我正在试用这个bigint库:https://mattmccutchen.net/bigint/在OSX Lion上。

我试着用他们网站上的例子制作一个简单的文件。

#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

有人能告诉我怎么了吗?

以防有人仍在寻找答案。我发现您必须深入研究Makefile,并弄清楚如何使用Makefile手动链接程序。我所做的是在bigint文件夹中,我运行了一次"makelibrary",然后,我在Makefile的最后跟踪样本,将库文件链接在一起。这是我试图解决SPOJ问题的Makefile: