Table of Contents
Visual Studio offers IntelliSense functionality to assist code writing. It can be also used with gcc based projects, provided that the project is properly configured. This chapter summarizes briefly settings that need to be altered to achieve satisfactory results. Note that IntelliSense is not WinGDB functionality, but Visual Studio. You can use it also without WinGDB, however without building and debugging capabilities of the IDE.
In order to benefit from IntelliSense you must have a Visual Studio project in the first place. IDE must know what source files to analyse. The project is the primary source of that information.
Project creation is performed exactly the same way as for regular Visual Studio C++ projects (for Windows). The presence of gcc-compiled code (even Unix specific) does not hamper IntelliSense, as it operates on source level only. Recommended project type is Windows Console Application. The project should be created in a location where your source files reside and are accessible from. The best place is the directory where the makefile resides. If you work on remote Unix machine and use a Synchronized type of mapping, create the project where your local copy of the sources is located. If you use a network share, it will be the shared volume. If you use MinGW or cross compiling, the situation becomes obvious, as you have all the sources locally on Windows. In all cases you might also consider adding the project and solution files (vcproj and sln) to you source code repository.
Additional advantage of using a project is a possiblity to store WinGDB settings in the suo file which is maintained by Visual Studio. Please see the Working with projects section for more information on using Visual Studio projects with WinGDB.
After creating the project, add your source files to it. Visual Studio then should be able to provide IntelliSense information for language constructs defined in files belonging to the project.
Apart from your own source files you might have some third party libraries that you want to be recognized by IntelliSense. If you want only information on interfaces defined by these libraries, add directories with header files to the Additional Include Directories field in the standard project properties dialog (C++/General tab). This way you will see public declarations and definitions, but not internal library details. If you want to browse also the latter ones, you have to add the full source code of the library to your solution.
There are also many headers provided by the operating system. In order to enable them for IntelliSense you have to make them accessible from your development Windows machine. This can be achieved by copying these files to the local machine, or some network shared volume visible from that machine. Then you have to provide paths to these include directories. You can do it either the same way as for third party libraries, or use global Visual Studio includes setting.
The latter one is located on the Tools/Options/Projects and Solutions/VC++ Directories tab. Select Include files from the list and add your directories on the beginning. This way has one disadvantage -- it will disallow to use Visual Studio for regular projects as the native VS compiler (cl.exe) will try to use Unix headers instead of Windows ones. To avoid that, use the approach with project properties. Newer versions of Visual Studio (starting with VS 2010) allow to add a custom platform and specify these paths per platform which solves that problem. In older versions, the Platform selector exists but it does not allow to add new platforms.
Table of Contents