I am trying to use the GMP 5.0.2 libraries in a demo C++ project in Xcode 4.0.2, but I'm having trouble getting the linking to work.
I looked at the comments in the StackOverflow post: Adding Linker Flags in Xcode, found the GMP library and header files in /usr/local/lib and /usr/local/include and dragged them to the project target. This allowed the project to compile, but apparently not to link. The error I'm getting is
Undefined symbols for architecture x86_64:
"operator>>(std::istream&, __mpz_struct*)", referenced from:
_main in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Any suggestions for what I should try next? Thanks.
#include <iostream>
#include "gmp.h"
#include <stdio.h>
using namespace std;
int main (int argc, const char * argv[])
{
mpz_t x;
mpz_init(x);
cin >> x;
cout << "x = " << endl;
// insert code here...
std::cout << "Hello, World!\n";
return 0;
}