Integrate MinGW with Visual Studio 2010 (Makefile Project)

I am trying to get MinGW (version 4.7.2) while working with Visual Studio 2010 to use some of the new features in C ++ 11 (unfortunately, I'm still on WindowsXP and can't use Visual Studio 2012). To start, I created a project with: File β†’ New Project β†’ Visual C ++ β†’ General β†’ 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 

And I created a make file with content:

 all: g++ -std=c++11 -pthread -o Makefile_Test.exe main.cpp 

It compiles just fine, but almost all the wavy reds are underlined in the Visual Studios editor. i.e.

 std::vector<std::thread> threads; 

std::vector β†’ 'Error: the std namespace does not have a member vector

std::thread β†’ 'Error: the std namespace does not have a member stream

flat std::cout << "";

std::cout β†’ 'Error: the std namespace does not have a cout member'

But I, of course, included the corresponding headers: and Visual Studio can even find them (place the cursor in #include β†’ Ctrl + Shift + G, it will open the header). My MinGw folder looks like this:

 + MinGW |- bin |- doc |- include |+ lib |- gettext |+ gcc |+ mingw32 |+ 4.7.2 |- debug |+ include |- c++ |... |- include-fixed |- install-tools |- libexec |- mingw32 |- msys |- share |- var 

I also tried to delete the sdf file several times and let Visual Studio rebuild it from scratch - but all these errors appeared again.

Any ideas what I'm doing wrong here?

+4
source share
2 answers

I am afraid that you will have to give up trying to make these red squiggles disappear if you do not completely disable them (for example, even calls to nonexistent functions will not be marked).

The reason is because Visual Studio Intellisense uses a separate interface for the C ++ EDG compiler to parse your program and possibly put a red curve in invalid expressions or expressions, and the version used by Intellisense in VS2010 (apparently) is not fully compatible with C ++ 11.

Therefore, the transition to GCC 4.7.2, since the compiler will help you in creating your C ++ 11 programs, but will not affect the behavior of Intellisense.

If you want to completely disable red squiggles, you can do this by choosing Tools β†’ Options β†’ Text Editor β†’ C / C ++ β†’ Advanced and setting β€œDisable Squiggles” to β€œTrue”.

+9
source

Using the Makefile project template described in OP. I was able to get the work of the Vell 2013 and 2015 intellisense community by adding the proper inclusion of dirs in project properties.

  • Open the Project menu
  • Select {Project Name} Properties
  • Open Configuration Properties
  • select VC++ Directories in the tree
  • Add directories to the Includes Directories section

You need to add directories containing the items you want to read in intellisense. Say I'm working on a gtkmm project, I would also include glibmm-dir, so Glib :: ustrings did not get squiggles. Even if glibmm.h is not directly included in my source files.

+1
source

All Articles