1

I am trying to use the GNU Multiple Precision (GMP) library in a C++ project. When I try to compile my code (using g++ project.cpp) I get the following output:

Undefined symbols for architecture x86_64:
"___gmpz_clears", referenced from:
  _main in project-d867c2.o
"___gmpz_inits", referenced from:
  _main in project-d867c2.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

From reading related questions, it seems like there is some conflict between 32-bit and 64-bit libraries. I don't know very much about this though.

How can I resolve this conflict?

john
  • 111
  • 2
  • Are you using VS? If so, what are you compiling the project as? x64 or x86? – Ashwin Gupta Nov 28 '16 at 04:07
  • [Before you post](http://www.catb.org/~esr/faqs/smart-questions.html#before) you should search stackoverflow and the web first. – MikeJRamsey56 Nov 28 '16 at 04:09
  • @MikeJRamsey56: understood. I'm at the point where I have sunk a number of hours into reading google results and stackoverflow answers, sadly without much progress - thought it most efficient to ask my own question at this point. – john Nov 28 '16 at 04:23
  • `g++ project.cpp` Duh, you didn't tell it to link with GMP... – Marc Glisse Nov 28 '16 at 07:45
  • The [ideal question](http://stackoverflow.com/help/how-to-ask) includes a summary of the searches and research that you have done. Even if you don't find a useful answer elsewhere on the site, including links to related questions that haven't helped can help others in understanding how your question is different from the rest. – MikeJRamsey56 Nov 28 '16 at 10:36

2 Answers2

0

One option in general for solving issues regarding 32 and 64 bit cmpatibility is to compile the source code of the library yourself. Although I know nothing about GMP, many C++ libaries use CMAKE or Visual Studio solutions for compilation.

On GMP's website, I found under the download section:

Instead of using a release, you may also get the latest code from the GMP repositories. This will require some more work compared to using a release.

There is a link on the text "GMP repositories" that ends up here: https://gmplib.org/devel/repo-usage.html

These appear to be instructions on compiling it yourself.

In your case, it seems that you are working with a 64 bit project and your GMP distribution is 32 bit. Another solution is to simply switch your project to a 32 -bit project if you aren't using the extra resources. Be warned: if you do that, you might break your code. Arrays allocated to excessive lengths or other OS specific function calls could be relying on the 64 bit type.

Ashwin Gupta
  • 2,159
  • 9
  • 30
  • 60
  • Thanks for this suggestion Ashwin. I haven't tried this kind of approach before, but I'll look into the instructions at that link you gave. – john Nov 28 '16 at 04:14
  • @john no problem. Good luck, I know getting the right binary can be frustrating. I nearly died trying to get freeGLUT :P. If this works, please remember to accept the answer. Otherwise, LMK with a comment, I'll probably get back to you tomorrow though since its late here. – Ashwin Gupta Nov 28 '16 at 04:15
  • thanks. Yes - I'm at the stage where I've sunk a number of hours into searching and trying various fixes. It's a bit frustrating at this point, but it's not the first time! Anyway, I will accept or comment by tomorrow. – john Nov 28 '16 at 04:22
  • @john did it ever work out? If you still need help, I might have a few ideas. – Ashwin Gupta Nov 30 '16 at 06:23
0

None of code contained in the GMS contains the necessary characters to conform to UNS 5TL.004A protocol. Therefore the elastic qualities of VUM and BUM system origins is not included in the lower portions of the code.

I would suggest a complete reboot after each line of code in modified to the UNS 5TL.004A protocol. Dr. Heywood Jablome has successfully combined the two bit maps and uses VM technology in two separate but combined stacks of data.

I hope this is helpful.