CGAL: GMP and MPFR Linker Errors

Problem

Compiling any Visual C++ solution that uses CGAL produces either or both of these errors:

1>LINK : fatal error LNK1104: cannot open file 'gmp-vc90-mt.lib'
1>LINK : fatal error LNK1104: cannot open file 'mpfr-vc90-mt.lib'

Solution

CGAL seems to look for GMP and MPFR libraries, whose names are suffixed with the Visual C++ version (vc90) and the build type (mt). However, CGAL stopped shipping pre-built GMP and MPFR libraries in such a format a while ago. Instead it ships a single library file for each. For example, in CGAL 3.8, these files are libgmp-10.lib and libmpfr-4.lib.

With this knowledge, this error can be fixed and the solution can be compiled like this:

  1. Ignore the library dependencies that are indicated by CGAL. This can be done by going to Properties → Linker → Input → Ignore Specific Library and adding gmp-vc90-mt.lib,mpfr-vc90-mt.lib
  2. Link with the available libraries instead. This can be done by going to Properties → Linker → Input → Additional Dependencies and adding libgmp-10.lib libmpfr-4.lib

The Visual C++ solution using CGAL should be able to build and execute without errors now.

Tried with: Visual C++ 2008 and CGAL 3.8

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.