win下clang+mingw如何使用c++11?

pngx
  • 87

给sublimetext装了个sublimeclang来给c++增加自动完成功能, 同时装了clang和mingw, 在sublimeclang里给clang应用以下配置:

"options":
    [
        "-m32",
        "-w",
        "-ferror-limit=9",
        "-fgnu-runtime",
        "-fms-extensions",
        "-nostdinc",
        "-isystem", "C:\\MinGW\\lib\\gcc\\mingw32\\4.8.1\\include",
        "-isystem", "C:\\MinGW\\lib\\gcc\\mingw32\\4.8.1\\include\\c++",
        "-isystem", "C:\\MinGW\\lib\\gcc\\mingw32\\4.8.1\\include\\c++\\mingw32",
        "-isystem", "C:\\MinGW\\include",
        "-D__GNUC__=4",
        "-D__GNUC_MINOR__=2",
        "-D__GNUC_PATCHLEVEL__=1",
        "-D__GXX_ABI_VERSION__=1002",
        "-Di386=1",
        "-D__i386=1",
        "-D__i386__=1",
        "-DWIN32=1",
        "-D_WIN32=1",
        "-D__WIN32=1",
        "-D__WIN32__=1",
        "-DWINNT=1",
        "-D__WINNT=1",
        "-D__WINNT__=1",
        "-D_X86_=1",
        "-D__MSVCRT__=1",
        "-D__MINGW32__=1",
        "-std=c++11"
    ]

    

之后尝试使用std::function时跳出以下错误:

C:/MinGW/lib/gcc/mingw32/4.8.1/include/c++\functional:485,35 - Error - expected '{'
C:/MinGW/lib/gcc/mingw32/4.8.1/include/c++\functional:488,36 - Error - expected '{'

然后就不知道要怎么办了...

回复
阅读 4.6k
1 个回答

mingw的话可以在添加-std=c++11选项来编译C++11

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
宣传栏