The first thing you should do, is to make sure that the Visual Studio edition you are using allows building of 64-bit code. The latest version of Microsoft Visual Studio contains everything you need to develop 64-bit applications.
Creating the 64-bit configuration
Creating the 64-bit version of a project in Visual Studio is a rather simple procedure. Difficulties will appear later, when building the new configuration, and searching for errors in it. To create a 64-bit configuration you should take the following 4 steps:
Open the configuration manager as shown in Figure 2:
Figure 2 – Launching the configuration manager
Choose support of the new platform in the configuration manager (Figure 3):
Figure 3 – Creating a new configuration
Choose the 64-bit platform (x64) and take the 32-bit version settings as the base (Figure 4). Visual Studio environment will automatically modify the settings which impact the build mode.
Figure 4 – Choosing x64 as the platform and loading the Win32 configuration as the base
You have now added the new configuration, and may now select the 64-bit configuration version, and start compiling the 64-bit application. Figure 5 shows how to choose the 64-bit building configuration.
Figure 5 – Now you have both the 32-bit and 64-bit configurations
If you are lucky, you will not have to make additional adjustments the 64-bit project. However, it strongly depends on the project, its complexity, and the number of libraries being used. The only thing you should modify right away is the stack size. If your project uses the default stack size, i.e. 1 Mbyte, you should change it to 2-3 Mbytes for the 64-bit version. It is not necessary, but it is better to secure yourself from possible issues beforehand. If you use the different to the default stack size, you should make it two-three times larger for the 64-bit version. To do this, find and change the parameters Stack Reserve Size and Stack Commit Size in the project settings (see Figure 6).
Figure 6 – Location of project settings defining the stack size
Having the 64-bit configuration for a project does not automatically mean that it will compile well, or work at all. The process of compilation and detection of hidden errors will be discussed in the next chapters.