我試圖讓MinGW(版本4.7.2)與Visual Studio 2010一起使用一些新的C++ 11功能(可惜我仍然在WindowsXP並且不能使用Visual Studio 2012)。 要開始,我創建了一個項目: 文件 - >新建項目 - >的Visual C++ - >常規 - > Makefile的項目MinGW與Visual Studio 2010集成(Makefile項目)
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
我創建了內容的生成文件:
all:
g++ -std=c++11 -pthread -o Makefile_Test.exe main.cpp
它編譯得很好,但在Visual Studio編輯器中幾乎所有內容都用波浪紅色加下劃線。即
std::vector<std::thread> threads;
std::vector
- > '錯誤:空間std沒有成員向量'
std::thread
- > '錯誤:空間std沒有構件螺紋'
甚至std::cout << "";
std::cout
- >'Error:namespace std has no member 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中從頭開始重建 - 但所有這些錯誤又出現了。
任何想法我在做什麼錯在這裏?
哦,我明白了!我沒有意識到這一點 - 謝謝! – Constantin
@Constantin:不客氣,祝你好運!) –
你錯了。錯誤:錯誤:命名空間std沒有成員向量'''錯誤:命名空間std沒有成員cout''當然不屬於C++ 11。我很好奇,在@Constantin做了一個像改變IDE編譯器這樣的常見事情之後,Intellisense變成了一個真正的問題。 –