Juan David
Juan David

Reputation: 25

Error compiling code in c++ using gmp

I copied a code that compiles and runs well from one computer to another, I installed the GMP library correctly. I'm tying to compile the code via g++ -o code -I/path/to/library code.cpp -lgmpxx -lgmp, I get the error invalid suffix '_mpf' on floating constant. Obviously I'm using _mpf, I don't understand why my code compiles and runs fine on one computer and not the other.

Upvotes: 0

Views: 263

Answers (1)

cdhowie
cdhowie

Reputation: 168948

User-defined suffixes are a C++11 feature. Add -std=c++11 to your compiler invocation.

You're not getting an error from the headers trying to define these operators because the operators are conditionally compiled only if you're compiling with C++11 support.

Upvotes: 3

Related Questions