#1383 MingW 4.0 g++ -std=c++0x

WSL
closed
nobody
duplicate
Duplicate
2013-02-01
2010-01-04
No

Hi,

I have an issue with MinGW GCC 4.0 when I compiling with -std=c++0x option.

// ---------- Code
#include <iostream>
int main(int argc, char** argv)
{
return 0;
}

// ---------- Code End

---------------- Compiler Errors
g++ -O0 -g3 -Wall -c -fmessage-length=0 -std=c++0x -osrc\core\__func__.o ..\..\..\src\core\__func__.cpp
In file included from c:\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/bits/postypes.h:42,
from c:\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/iosfwd:42,
from c:\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/ios:39,
from c:\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/ostream:40,
from c:\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/iostream:40,
from ..\..\..\src\core\__func__.cpp:24:
c:\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/cwchar:159: error: '::swprintf' has not been declared
c:\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/cwchar:166: error: '::vswprintf' has not been declared
Build error occurred, build is stopped
Time consumed: 1031 ms.

Many thanks,
Fernando Pelliccioni

Discussion

  • Keith Marshall
    Keith Marshall
    2010-01-25

    I believe this is a known bug. It isn't specific to the -std=c++0x option, but rather to any option which restricts code to __STRICT_ANSI__. The issue is that the prototypes for swprintf() and vswprintf() are not exposed when __STRICT_ANSI__ is in effect, (because the Microsoft implementations don't conform to the ANSI standard, IIRC), yet the cwchar header unconditionally attempts to assign these functions to the std namespace.

    I don't believe we've identified an ideal solution for this, because the unconditional assumption of availability is in a stock GCC header, (from the upstream project); thus this needs to be addressed upstream. As a workaround, you could patch your locally installed cwchar header to exclude the assignment of those two functions to the std namespace, when __STRICT_ANSI__ is defined.

     
  • Keith Marshall
    Keith Marshall
    2010-02-05

    • labels: 456608 --> gcc
    • status: open --> closed-duplicate
     
  • Earnie Boyd
    Earnie Boyd
    2013-02-01

    • labels: gcc --> gcc, g++
    • status: closed-duplicate --> closed
    • resolution: --> duplicate
    • category: --> Duplicate
    • milestone: --> WSL