簡體   English   中英

C++中BigInt庫的問題

[英]Problems with BigInt Library in C++

所以我在 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 中編譯它時,output 是:

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 文件夾中,我運行了一次“make library”,然后,我跟着Makefile 末尾的樣本將庫文件鏈接在一起。 這是我的Makefile試圖解決SPOJ 問題

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM