【发布时间】:2013-03-19 03:21:49
【问题描述】:
我正在尝试让 MinGW(版本 4.7.2)与 Visual Studio 2010 一起使用以使用一些新的 C++11 功能(遗憾的是,我仍在使用 WindowsXP,无法使用 Visual Studio 2012)。 首先,我创建了一个项目: 文件 -> 新建项目 -> Visual C++ -> 常规 -> Makefile-Project
General:
Build Command Line: mingw32-make.exe
Rebuild All Command Line: mingw32-make.exe rebuild all
Clean Command Line: mingw32-make.exe clean all
IntelliSense:
Include Search Path: C:\MinGW\lib\gcc\mingw32\4.7.2\include\c++;C:\MinGW\include;
Assembly Search Path: C:\MinGW\lib\gcc\mingw32\4.7.2;C:\MinGW\lib;
Additional Arguments: -std=c++11
我创建了一个包含内容的makefile:
all:
g++ -std=c++11 -pthread -o Makefile_Test.exe main.cpp
它编译得很好,但在 Visual Studios 编辑器中几乎所有内容都带有波浪红色下划线。即
std::vector<std::thread> threads;
std::vector -> '错误:命名空间 std 没有成员向量'
std::thread -> '错误:命名空间 std 没有成员线程'
甚至std::cout << "";
std::cout -> '错误:命名空间 std 没有成员 cout'
但我当然包含了相应的标题:Visual Studio 甚至可以找到它们(将光标放在#include -> Ctrl+Shift+G 打开标题)。我的 MinGw 文件夹如下所示:
+ MinGW
|- bin
|- doc
|- include
|+ lib
|- gettext
|+ gcc
|+ mingw32
|+ 4.7.2
|- debug
|+ include
|- c++
|...
|- include-fixed
|- install-tools
|- libexec
|- mingw32
|- msys
|- share
|- var
我也尝试过几次删除 sdf 文件并让 Visual Studio 从头开始重建它 - 但所有这些错误再次出现。
有什么想法我在这里做错了吗?
【问题讨论】:
标签: c++ visual-studio-2010 c++11 mingw makefile