0

I'm trying to compile the FreeImage v3.17.0 library by using Visual Studio 2015 to get the static library file but there are some problems.

The library package comes as follow:

I used the FreeImage.2013 file to compile the library, and after the compilation is done I found this result Build: 16 succeeded, 4 failed, 0 up-to-date, 0 skipped.
the FreeImage library itself did not compile but the other third-party libraries have been compiled, but there's an error appear: Error C1189 #error: Macro definition of snprintf conflicts with Standard Library function declaration ..\include\10.0.10240.0\ucrt\stdio.h

How to resolve that problem?

Lion King
  • 32,851
  • 25
  • 81
  • 143

1 Answers1

0

I found the solution in another problem similar to my problem but in a different subject. Take a look.

Explain the problem:

Until now, many libraries and programs used snprintf() function by defining it as _snprintf(), since _snprintf() was supported.

#define snprintf _snprintf

snprintf() became recognized in visual studio 2015 (v140). So, snprintf() is now officially supported, We should never define it.
Doing it will overshadow new snprintf() function defined in stdio.h.

The Solution:
Search for this line #define snprintf _snprintf in all projects files and make it a comment (put // at the beginning of the line).

An example:

Lion King
  • 32,851
  • 25
  • 81
  • 143