C++0x with Qt Creator

后端 未结 1 1463
刺人心
刺人心 2021-02-05 16:39

I\'m trying to use new C++0x features in Qt Creator under Windows (Qt Creator 2.0.1).

I read the thread Configuring the GCC compiler switches in Qt, Qt Creator, and Q

1条回答
  •  爱一瞬间的悲伤
    2021-02-05 16:58

    First off, it could be that the library headers just don't represent their dependencies properly. Try adding an #include and perhaps (unfortunately) a using namespace std; to your file at the top.

    Failing that, several people seem to have had issues with MinGW and swprintf. This mailing list post suggests adding this:

    #ifdef WIN32
    #define swprintf _snwprintf
    #endif
    

    See if that resolves the issue. (You want it at the very top of the file, too.)

    If prepending random defines to your source seems like a bad idea to you, I suggest using -D build flags to conditionally inject the above define when you're building on MinGW.

    See also this short discussion on the differences between swprintf on MinGW vs. other compilers.

    Finally, failing all else, this link seems to attribute the problem to an issue with flags that enable __STRICT_ANSI__ in MinGW, and suggests commenting out a couple of lines in one of the MinGW headers to fix the issue. I would suggest adding a simpler #ifndef __STRICT_ANSI__ around them instead if you decide to go with this hack.

    0 讨论(0)
提交回复
热议问题