Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS2017 #error: : Macro definition of snprintf conflicts with Standard Library function declaration

I'm trying to build an application developed in VS 2010 with VS2017. When I'm building the application I'm getting the following error:

error: : Macro definition of snprintf conflicts with Standard Library function declaration

I tried to solve this issue like as here. But It doesn't work in my case.

I'm using windows 10 with VS2017 community 15.8.2.

like image 404
JosepB Avatar asked Jan 28 '23 11:01

JosepB


1 Answers

As the error in your question shows, you have a macro definition for snprintf that is no longer compatible with your current version.

So you need to look for the following:

#define snprintf _snprintf

You can either remove it or if you need to also compile your code with Visual Studio 2010 you can add the following condition:

#if _MSC_VER < 1700 
#define snprintf _snprintf
#endif
like image 137
Isma Avatar answered Feb 06 '23 15:02

Isma