简体   繁体   中英

Problems with BigInt Library in C++

So I'm trying out this bigint library: https://mattmccutchen.net/bigint/ on OSX Lion.

I tried making a simple file using the example on their site.

#include <iostream>
#include <bigint/BigIntegerLibrary.hh>
using namespace std;

int main(){
  BigInteger a;
  int b=5;
  a=b;
  cout<<a;
return 0;
}

When I compile this in textmate, the output is:

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

Can anyone tell me what is wrong?

just in case anyone is still looking for answers to this. I found that you have to dig into the Makefile a little bit and figure out how to manually link the program using the Makefile. What I did is in the bigint folder, I ran "make library" once, then later on, I followed the samples at the very end of the Makefile to link the library files together. Here is my Makefile trying to solve an SPOJ problem :

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM