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 7543781
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T08:31:02+00:00 2026-05-30T08:31:02+00:00

I’m trying to build CGAL for windows to use in my project under Visual

  • 0

I’m trying to build CGAL for windows to use in my project under Visual Studio 2010. CGAL requires GMP and MPFR libraries and provides them in distribution. However, it provides them as a lib+dll bundle, while I want them to be compiled statically in form of a single .lib file.

So now I’m trying to build GMP and MPFR as a static library under windows. I’m using cygwin for this purpose as suggested here. After call to configure and make I have output libs with .a extension with additional .la file. I don’t really know much about static libraries for Unix, so I suggested it is the same as .lib with just different extension. I renamed it to .lib and linked to my project – it fitted well.

The first question: was I correct doing so? Are the .a and .lib files really the same? I saw this question, but didn’t find it useful enough.

Then problem arose: I had

error LNK2019: unresolved external symbol ___getreent referenced in function ___gmp_default_reallocate

Seems like some cygwin functions are not linked in resulting gmp.lib. I found here, that getreent may be exported from libcygwin.a. So I copied it to libcygwin.lib and linked to my project. Not surprisingly, I received the following error:

error LNK2005: _strcpy already defined in libcygwin.lib(t-d001719.o) in libcmtd.lib(strcat.obj) 

Of course, I cannot know what functions and how are declared in this library and seems like strcpy is conflicting with one from Visual Studio. What I really want to happen is gmp.lib would be smart enough to link this function statically. So,

The second question: how to force GMP to link library dependencies? or How to properly build GMP for windows without using cygwin?

  • 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-05-30T08:31:03+00:00Added an answer on May 30, 2026 at 8:31 am

    UPDATE: See the MPIR project page for the answer to all your problems (it allows you to build MPIR, a GMP compatible library, and MPFR with Visual Studio). The new MPIR homepage is located here, but lacks the MPFR info as far as I can tell.


    You don’t want Cygwin.

    You need a Bash shell and MinGW(.org/-w64). If you build with the cygwin compiler, you need to link to the Cygwin DLL, which in your case is stupid, as GMP and MPFR both are buildable by MinGW.

    The only thing is: I don’t believe either library is buildable by MSVC, and MSVC can’t link with MinGW libraries (this is exactly the reason your project’s authors bundled DLL’s and import libraries), so you’ll need to build everything with MinGW GCC or use the DLL’s.


    Below are instructions for building a GCC static library of GMP and MPFR.

    In order to build GMP for Windows with MinGW-w64 GCC, you’ll need MSYS. Unzip this somewhere like C:\Dev\msys so that C:\Dev\msys\bin\sh.exe is present.

    Then you’ll need a MinGW-w64 GCC:

    • 32-bit
    • 64-bit

    (I recommend my “Personal Builds”, especially the 4.6.3-1 package. Download the 4.6.3-1-gcc_rubenvb.7z package, but any other MinGW bundle should do for this)

    Unzip that to say C:\Dev\mingw64 so that C:\Dev\mingw64\bin\gcc.exe exists.

    Double click on C:\Dev\msys\msys.bat. Type:

    export PATH=/c/Dev/mingw64/bin:$PATH
    

    And press enter. Unzip the GMP and MPFR source to your /home/USERNAME/* directory, make build directories, and remember to use for configure:

    --enable-static --disable-shared --prefix=/easytemplibinstalldir
    

    along with

    --host=i686-w64-mingw32
    

    for 32-bit or

    --host=x86_64-w64-mingw32
    

    for 64-bit. I believe GMP also requires --build set to the same value. After configure finishes, type make, and then make install, optionally preceded by make check.

    You should have libgmp.a in /easytemplibinstalldir/lib. For MPFR, add

    --with-gmp=/easytemplibinstalldir
    

    to its configure line.

    You will have to manually link both libgmp and libmpfr in the correct order for it to work, no automated dependency linking is possible on Windows for this.

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

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am trying to render a haml file in a javascript response like so:
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out

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.