10

I am trying to compile Botan on Windows with MinGW, and am receiving the following error during compilation:

c:\qt\2010.04\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/cwchar:159: error:
'::swprintf' has not been declared
c:\qt\2010.04\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/cwchar:166: error:
'::vswprintf' has not been declared

Why are swprintf and vswprintf not declared, and how can I fix this?

Jake Petroules
  • 23,472
  • 35
  • 144
  • 225
  • 1
    Did any of you file a bug report at Qt? –  Dec 29 '11 at 09:56
  • Just a note, `vswprintf` should actually be called as [`wvsprintf`](https://msdn.microsoft.com/en-us/library/windows/desktop/ms647551(v=vs.85).aspx) on Windows. You'd expect it to be `vwsprintf()` or `vwcsprintf()` or something following the other conventions, but `wvsprintf()` it is. – bobobobo Apr 20 '16 at 14:43

3 Answers3

11

Try putting in

#undef __STRICT_ANSI__ 

before including stdio.h

carlsborg
  • 2,628
  • 19
  • 21
  • Or don't compile with the -ansi switch? Looks like buggy headers. – wilx Aug 10 '10 at 10:27
  • 4
    Compiling with `-std=c++0x` seems to cause this even without an explicit `-ansi` (in ye olde MinGW GCC 4.4.0). A newer GCC should fix it (and make `-std=c++0x` redundant) but I haven't checked yet. –  Jun 05 '12 at 11:23
3

had the same problem compiling Grantlee using MinGW (Qt 2010.05).

How I got it to compile:

  • find file cwchar (C:\Qt\2010.05\mingw\lib\gcc\mingw32\4.4.0\include\c++\cwchar)
  • comment the following lines out (around line 160)

    using ::swprintf;

    using ::vswprintf;

Sebastian
  • 163
  • 1
  • 7
2

When running make ensure that -ansi flag is not set. If this flag is being used then remove it and the problem will be solved.

sabertooth1990
  • 1,048
  • 1
  • 13
  • 19