Wild Magic 5: unresolved external symbol ZERO_TOLERANCE in DLL

Geometric Tools’ Wild Magic library is a great free, open-source and cross-platform C++ library for computational geometry and beyond. Recently, when dynamically linking against latest version 5.9 of the Wild Magic library on Windows in Visual Studio Express 2010, I ran into the following error:

error LNK2001: unresolved external symbol "public: static double const Wm5::Math<double>::ZERO_TOLERANCE" (?ZERO_TOLERANCE@?$Math@N@Wm5@@2NB) SiSTunneld.exe : fatal error LNK1120: 1 unresolved externals

A quick check revealed that the symbol was indeed properly exported from the library (dllExport). However, my code was not properly importing the symbols (dllImport). The Wild Magic library is set up to properly import a DLL’s symbol by defining a set of preprocessor definitions, one for each library (all this is well described in Wild Magic’s Installation Manual and Release Notes on page 15).

So when using the Core and Mathematics libraries, set the preprocessor defines

WM5_CORE_DLL_IMPORT 
WM5_MATHEMATICS_DLL_IMPORT

in your Visual Studio project. This will properly import all symbols and resolve any unresolved linker errors.

 

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s