Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7835355
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T13:36:16+00:00 2026-06-02T13:36:16+00:00

I have built GMP for MinGW. The IDE I’m using is Code::Blocks. I don’t

  • 0

I have built GMP for MinGW. The IDE I’m using is Code::Blocks. I don’t have any problems with C functions of GMP. But I’m having problem with C++. The program I tried to run is as simple as this,

#include<iostream>
#include<gmpxx.h>
using namespace std;

main()
{
    mpz_class a;
    a=12345;
    cout<<"value"<<a<<"\n";
    return 0;
}

And the Errors I get are

F:\Compilers\C_Libraries\GMP\lib\libgmpxx.a(osmpz.o):osmpz.cc|| undefined reference to `__gmpz_get_str'|
F:\Compilers\C_Libraries\GMP\lib\libgmpxx.a(osfuns.o):osfuns.cc:(.rdata+0x1c)||undefined reference to `__gmp_asprintf_memory'|
F:\Compilers\C_Libraries\GMP\lib\libgmpxx.a(osfuns.o):osfuns.cc:(.rdata+0x20)||undefined reference to `__gmp_asprintf_reps'|
F:\Compilers\C_Libraries\GMP\lib\libgmpxx.a(osdoprnti.o):osdoprnti.cc|| undefined reference to `__gmp_doprnt_integer'|
F:\Compilers\C_Libraries\GMP\lib\libgmpxx.a(osdoprnti.o):osdoprnti.cc|| undefined reference to `__gmp_asprintf_final'|
||=== Build finished: 5 errors, 0 warnings ===|

Now, some additional data:

  1. I don’t have any problem with C functions. And also, if I remove cout<< statement the file compiles and runs fine. The problem is probably with overloaded operators.
  2. libgmpxx.a and libgmp.a are linked with compiler. It can be seen in the error messages too…
  3. The problem is probably with the libgmpxx.a alone. So, I built the Library again, but the files are same.
  4. I used this tutorial build GMP with MSYS for MinGW. http://www.cs.nyu.edu/exact/core/gmp/ and http://suchideas.com/journal/2007/07/installing-gmp-on-windows/
  5. The version of GMP I’m using is 5.0.4.

So, what I want to know is, what could be the problem? And how could it be solved?
And, if unsolvable and if you have the working files for 5.0.4 version, please share it. 🙁

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T13:36:18+00:00Added an answer on June 2, 2026 at 1:36 pm

    I suspect the command to build your program specifies the libgmp* libraries in the wrong order. Make sure the libgmp.a library is specified after the libgmpxx.a library:

    -lgmpxx -lgmp
    

    If they are specified in the other order, then when pulling in dependencies from libgmpxx.a library, the libgmp.a library won’t be searched.

    From the ld linker’s docs on the -l option:

    The linker will search an archive only once, at the location where it
    is specified on the command line. If the archive defines a symbol
    which was undefined in some object which appeared before the archive
    on the command line, the linker will include the appropriate file(s)
    from the archive. However, an undefined symbol in an object appearing
    later on the command line will not cause the linker to search the
    archive again.

    See the -( option for a way to force the linker to search archives
    multiple times.

    You may list the same archive multiple times on the command line.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have built ffmpeg for Android using the code and method described at https://github.com/halfninja/android-ffmpeg-x264
I have built working VB.net code that uploads multiple images to the server using
i have built application using codeigniter, my controller name is userReg , in controller
I have built an enumeration in javascript using the following syntax: MyEnum = {
I have built a C++ exe using my own makefiles. I have Eclipse CDT.
I need to use GMP in an iphone program I'm working on, but don't
Sage is supposed to be able to create compiled code using Cython. I have
I have built my app using Storyboards. I have a UITabBarController and a NavigationController
I have built a child theme in wordpress. I'm using jQuery to hide and
I have built a simple StreamGeometry, using MSDN example: StreamGeometry geometry = new StreamGeometry();

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.