我想在 qt creator 的项目中使用 c++11。我试图通过将以下内容之一添加到 .pro 文件来添加 c++11 支持:
CONFIG += c++11
或者
QMAKE_CXXFLAGS += -std=c++11
但是它们都不适合我,在将这些添加到 .pro 文件后,编译器(mingw 4.8)给了我很多错误,例如:
C:/Qt/Qt5.3.2/Tools/mingw482_32/i686-w64-mingw32/include/c++/cstdint:48:11: error: '::int8_t' has not been declared using ::int8_t; ^
C:/Qt/Qt5.3.2/Tools/mingw482_32/i686-w64-mingw32/include/c++/cstdint:49:11: error: '::int16_t' has not been declared using ::int16_t; ^
C:/Qt/Qt5.3.2/Tools/mingw482_32/i686-w64-mingw32/include/c++/cstdint:50:11: error: '::int32_t' has not been declared using ::int32_t; ^
C:/Qt/Qt5.3.2/Tools/mingw482_32/i686-w64-mingw32/include/c++/cstdint:51:11: error: '::int64_t' has not been declared using ::int64_t; ^
C:/Qt/Qt5.3.2/Tools/mingw482_32/i686-w64-mingw32/include/c++/cstdint:53:11: error: '::int_fast8_t' has not been declared using ::int_fast8_t;
问题是什么??!
最佳答案
如果您使用的是 cstdint
,您必须提供需要using
对于这些类型。
插入
using ::int8_t;
using ::int16_t;
using ::int32_t;
using ::int64_t;
using ::int_fast8_t;
(以及报告丢失的所有其他内容)到发生这些错误的源文件中。
关于此主题的更多信息 here .
关于qt - 在 qt creator(mingw 4.8 和 qt 5.3)中使用 c++11 功能时出现奇怪的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31228354/