0

I am using macbook maverick and I tried to compile the parser from this website: http://www.cril.univ-artois.fr/PB16/coding.html

I am trying to compile http://www.cril.univ-artois.fr/PB16/parser/SimpleParser.cc

I ran

g++ -g -DuseGMP -o testCC SimpleParser.cc -lgmpxx -lgmp

This comes from the makefile on that website but it doesn't work neither. I get the error of:

Undefined symbols for architecture x86_64:
  "operator<<(std::basic_ostream<char, std::char_traits<char> >&, __mpz_struct const*)", referenced from:
      std::basic_ostream<char, std::char_traits<char> >& operator<< <__mpz_struct [1], __mpz_struct [1]>(std::basic_ostream<char, std::char_traits<char> >&, __gmp_expr<__mpz_struct [1], __mpz_struct [1]> const&) in ccuZ3ElV.o
  "operator>>(std::basic_istream<char, std::char_traits<char> >&, __mpz_struct*)", referenced from:
      std::basic_istream<char, std::char_traits<char> >& operator>><__mpz_struct [1]>(std::basic_istream<char, std::char_traits<char> >&, __gmp_expr<__mpz_struct [1], __mpz_struct [1]>&) in ccuZ3ElV.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status

How can I solve this problem? I see other questions about this error but mostly there is another file that needs to compile together. But in this case there is only one file, namely SimpleParser.cc in my case. Thank you in advance.

Ka Wa Yip
  • 2,546
  • 3
  • 22
  • 35
  • maybe you downloaded a library for different OS (eg. Windows)? – Joseph D. Apr 06 '18 at 05:15
  • @codekaizer there is no library the only code is SimpleParser.cc in http://www.cril.univ-artois.fr/PB16/parser/SimpleParser.cc and I tried to compile this. – Ka Wa Yip Apr 06 '18 at 05:32

1 Answers1

0

After some searching about GMP, for example in C++ gmp and homebrew

and many attempts afterwards, I tried the following command:

clang++ -L /opt/local/lib -I /opt/local/include -g -DuseGMP -lgmpxx -lgmp SimpleParser.cc -o testCC

And it seems to work.

Ka Wa Yip
  • 2,546
  • 3
  • 22
  • 35