(C++) ::swprintf has not been declared

February 24, 2017 · View on GitHub

 

 

 

 

 

(C++) ::swprintf has not been declared

 

Qt CreatorWindows

 

::swprintf has not been declared is a compile error I encountered when using Qt Creator under Windows 7.

 

 

 

 

 

Solution

 

Add the following statement before the first #include:


#undef __STRICT_ANSI__

 

Or more portable:

 


#ifdef _WIN32 #undef __STRICT_ANSI__ #endif

 

 

 

 

 

 

 

Contents

  1. 1Solution
  2. 2#undef __STRICT_ANSI__
  3. 3#ifdef _WIN32 #undef __STRICT_ANSI__ #endif