【问题标题】:Problems with BigInt Library in C++C++ 中 BigInt 库的问题
【发布时间】: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 文件。

标签: c++ bigint


【解决方案1】:

以防万一有人仍在寻找这个问题的答案。我发现您必须深入研究 Makefile 并弄清楚如何使用 Makefile 手动链接程序。我所做的是在 bigint 文件夹中,我运行了一次“make library”,然后,我按照 Makefile 末尾的示例将库文件链接在一起。这是我的Makefile 试图解决an SPOJ problem

【讨论】:

    猜你喜欢
    • 2011-02-11
    • 1970-01-01
    • 1970-01-01
    • 2010-09-17
    • 1970-01-01
    • 2016-09-29
    • 1970-01-01
    • 2020-04-12
    • 1970-01-01
    相关资源
    最近更新 更多