Hello. I have an issue that isn't necessarily related to mingw-w64.
Could be gcc/g++, libstdc++ or even my mistake. Let me have a starting
point here.

I downloaded Mingw-w64 GCC toolchains (5.4.0, 6.4.0, sjlj, x86
version) from here:

https://sourceforge.net/projects/mingw-w64/files/Multilib%20Toolchains%28Targetting%20Win32%20and%20Win64%29/

then tried compiling a program with each compiler version.

Running Windows 8.1 x64.

[Case 1] The following code works if compiled as C code (gcc test.c -o
test.exe -municode -static)

/*
   test.c

   expected output:

   Hello World
*/

#include <stdio.h>

int
wmain (void)
{
    wprintf(L"%s %s\n", L"Hello", L"World");
    return 0;
}

[Case 2] Rename the file to test.cpp and compile it as C++ (g++
test.cpp -o testcpp.exe -municode -static). Also no problem.

[Case 3] If I change the #include line to

#include <cstdio>

The code still compiles (as C++) but it prints out

H W

{side note: not sure whether wprintf is supposed to be available in cstdio.}

[Case 4] Change the #include line to

#include <cwchar>

and still produces

H W

{side note: wprintf is supposed to be available in cwchar.}

[Question] Did I do something wrong or is the issue not related to
mingw-w64? (it looks like a libstdc++ problem, since cstdio and cwchar
are C++ headers, but I am not sure).

Thanks.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to