Visual Studio has a branded name with a year (like Visual Studio 2013), but also an internal version number. Visual Studio supports a C++ compiler, a C# compiler, the .Net Framework and many other internal tools. Each of these also have their own version names and numbers. Confusingly, either the year-version or version-number is used at several places in Windows.
Here is some information I note down and update as I use these software:
Visual Studio 2015
- Visual Studio: 14
- Visual C++ compiler: 19.0.23026.0
- Visual C compiler: 19.0.23026.0
Visual Studio Professional 2013
- Visual Studio: 12.0
- Visual C++ compiler: 18.0.21005.1
- Visual C compiler: 18.0.21005.1
- Microsoft .Net Framework: 4.5.50938
Visual Studio Professional 2012
- Visual Studio: 11.0
- Visual C++ compiler: 17.00.50727.1
- Visual C compiler: 17.00.50727.1
If your code compiled with Visual Studio needs Boost, you can get prebuilt Boost libraries. However, if your code needs to link with Boost library files, then the Visual Studio version used for your code and used to build Boost has to match. If you cannot find a prebuilt Boost library matching your Visual Studio then you might have to build Boost by yourself.
I had this problem since my code was using C++11 features that required Visual Studio 2015, but the prebuilt Boost libraries were only available for Visual Studio 2012.
To build Boost for Visual Studio, I followed these steps:
- Build Boost using this compile invocation:
> b2 toolset=msvc-14.0 --build-type=complete --abbreviate-paths architecture=x86 address-model=64 install -j4
toolset: Use this to specify the Visual C++ compiler to use. For Visual Studio 2015, this is
msvc-14.0. For other versions of Visual Studio see this post.
architecture: This is the processor architecture. Keep this
x86 for both 32-bit and 64-bit builds!
address-model: Use this to specify whether you want
64 bit library to be built.
-j: Use this to specify how many cores to use for parallel compilation.
- This compilation took about 30 minutes and after it is done, the Boost header files and built libraries are dumped in
Note: Detailed steps to build Boost for Visual Studio can be found in this StackOverflow post.
Tried with: Boost 1.59, Visual Studio 2015 and Windows 7 x64
When developing a C++ program using Visual Studio, you typically compile and run it from the Visual Studio IDE. By default, when you do this, the executable is run with the working directory being the directory containing the Visual C++ project (
.vcxproj). That is, this is the directory which acts as the current directory for your executable, when it run from within Visual Studio. Note that if you ran the executable from a commandline, then the working directory would be the current directory of your command prompt.
This behavior can be irritating if you have some files that your program needs to read or write. It would be nice if the executable considered the directory it resides in as the working directory. Changing this is easy:
- Open Project > Properties > Configuration Properties > Debugging.
The Working Directory entry would be
$(ProjectDir) by default. Change it to whatever you wish. If you want it to be the same directory as the place where the executable resides in, then change it to
Tried with: Visual Studio 2012 and Windows 7 x64
wxWidgets is a cross-platform GUI library, that is also available for Windows. You can get started with using wxWidgets in a few steps:
- Download and install the Windows installer for the current stable release of wxWidgets from its download page. It installs the source and build files in
C:. For example, in
wxWidgets needs to be built before it can be used with your application. Go to
C:\wxWidgets-3.0.0\build\msw and open the
.sln file that matches the Visual Studio version you intend to use for your application. For example, I open
wx_vc10.sln using Visual Studio 2010.
Choose one of the build types:
DLL Debug or
DLL Release and build the solution. The resulting
.lib files are placed in
Create a new Visual Studio solution for your C++ application. Remember that it has to be
Win32 Project, not a
Win32 Console Project. The difference is that the
main function is defined inside wxWidgets and does not need to be defined in your application code.
.cpp file to your solution and copy the Hello World code into it.
C:\wxWidgets-3.0.0\include\msvc as additional include directories to the solution.
C:\wxWidgets-3.0.0\lib\vc_lib as additional library directory to the solution.
Build the solution and run it to see an empty wxWidgets window.
Tried with: wxWidgets 3.0.0, Visual Studio 2012 and Windows 7 x64
The typical method to create Qt applications is use its Qt Creator as the IDE to write and debug Qt code. (See this post for info.) If you use Visual Studio, you might find it frustrating to learn yet another IDE. In such a case, you can actually create Qt applications using Visual Studio.
- Download a suitable Qt installer from the downloads page and install it. Make sure you pick an installer that is 32-bit and built for the Visual Studio version that you have.
Download and install the Qt Visual Studio add-in. You can find it at the bottom of the downloads page. Make sure you pick an installer that matches the Visual Studio version that you have. At the time of this writing, the Visual Studio add-ins were built only for 32-bit version of Qt. That is the reason I used 32-bit in Step 1.
Open your Visual Studio. In the toolbar, there is a new menu named
Qt5. Go to Qt5 > Qt Options. In the
Qt Versions tab, add the path to the Qt you installed in Step 1. Note that you need to add the path to the parent directory of the
bin directory of Qt. For example, on my particular installation this path was
Create a Qt project. To do this, open File > New > Project and choose Qt5 Projects > Qt Application. After you provide the name and path, a Qt wizard pops up to handle the Qt specific details of this project. Once you are done with it, you will be dropped into a project with sample source and interface files.
Build the Qt project by choosing Build > Build Solution. This is where the Qt add-in steps in and does its meta-object magic before letting the Visual C++ compiler to compile the generated files.
The build should hopefully succeed. You can now execute and even debug the Qt application from Visual Studio.
Tried with: Qt 5.2.0, Qt Visual Studio add-in 1.2.2, Visual Studio 2012 and Windows 7 x64
The VsVim extension brings Vim key bindings and interface to Visual Studio. This is similar to the Vrapper plugin for Eclipse.
Installing VsVim is straightforward. Go to Tools > Extension Manager. Choose Online Gallery and search in the top right box for VsVim. Choose VsVim from the search results and click Install. Once install is done, restart Visual Studio.
VsVim adds its own bar at the bottom of the editor window. This is used to display the Vim commands you type and their results. There are many common Vim commands that have pre-defined bindings in Visual Studio. You can pick and choose which of these you want to retain with Visual Studio or grab for Vim. This can be done by clicking the
Options button in the bottom VsVim bar.
If you want to look at the VsVim source code or help add a feature, go to its Github page.
Tried with: VsVim 184.108.40.206, Visual Studio 2010 and Windows 8 x64
If you used Visual Studio to write C++ or CUDA code, then you are familiar with using the Release and Debug build configurations. Having these two pre-defined configurations helps you write correct code first and then optimize it for speed to release it to your users.
Similar to that, Release and Debug build configurations are available for C++ and CUDA code in Eclipse CDT and NSight Eclipse Edition too. The only problem is that Eclipse hides this, so you are not even aware that this exists and which configuration you are currently working with.
To view or switch the current Build Configuration just go to Project > Build Configurations > Set Active
To change the compiler options and other settings that are used with a Build Configuration, right-click on the project name in Project Explorer and choose Properties > C/C++ Build. You can see the current configuration in the dropdown at the top and change it to a different one. All the settings under this section are part of the chosen Build Configuration.
Tried with: Eclipse 3.7.2, Eclipse CDT 8.0.2 and Ubuntu 12.04 LTS
On Windows, library files (.lib) are commonly produced by compilation using the Visual C++ compiler. Sometimes, you may want to know which library file exports the definition of a certain function or global variable.
The definitions exported by a library file can be listed by using the dumpbin tool. This ships with Visual Studio and can be invoked by opening the Developer Command Prompt for Visual Studio.
To list the symbols exported by a library file use:
C:\> dumpbin /exports foo.lib
Note that C function definitions will have an underscore as prefix. But, C++ definitions will be much more mangled. However, if you know the function name or even a substring of it, you could investigate using the output of this program.
Tried with: Visual Studio 2012 and Windows 7 x64
The Tao Framework is a .Net wrapper library for the OpenGL, GLU, FreeGLUT and Cg libraries. It is now deprecated and its functionality has been superseded by the OpenTK project. However, it is perfect for writing simple OpenGL or GLUT programs in .Net languages like C#.
Getting started on the Tao Framework using C# is easy:
- Download and install the last version of Tao Framework from here. The installer will add its .Net assemblies to the GAC.
- Create an empty C# console application project in Visual Studio.
- Add references to Tao.OpenGL.dll and Tao.FreeGLUT.dll to the project. These files can be found in C:\Program Files (x86)\TaoFramework\bin
- Paste the source code given below into the C# source file.
- Copy FreeGLUT.dll from C:\Program Files (x86)\TaoFramework\lib to directory of the generated EXE file.
- Run the program. You should see a grey teapot!
- Whether you are porting an existing C or C++ OpenGL application or writing your own, it should be easy to build upon this program.
Tried with: Tao Framework 2.1.0, Visual Studio 2012 and Windows 7 x64