LKBEN10744: Cannot compile 64-Bit applications on Vista 64 with Visual Studio 2008


Symptom

You would like to start programming 64 Bit application but cannot find the compiler settings

Cause

In the default installation you do not have the 64-Bit tools. You will have to install them!

Solution

The default installation, even on a 64-Bit System does not contain the tools for 64-Bit programming. You will have to install them explicitely. After you installed them, you can add the x64 Platform in the configuration manager. You click on the "Configuration Manager", click on new, select x64 as the platform and copy the settings from win32. The IDE will do the rest for you.

Please note the path change for the output. 32-Bit compilation will be written to debug, 64-Bit will be written to x64/debug.

You can test your configuration with the following program.


#include "stdafx.h"
#include <stdio.h>

void main(void)
{
 __int64 *p;
 long long l;

 if ((sizeof(p)==4) && (sizeof(l)==4)) /* 32-bit mode */
  printf("\n32-bit compilation!\n");
 else
  printf("\n64-bit compilation!\n"); /* 64-bit mode */

 printf("\nSize of int*: %d bytes", sizeof(p));
 printf("\nSize of long: %d bytes\n", sizeof(l));

 return;
}



This should deliver the following output:

C:\data\Code\32or64\x64\Debug>32or64.exe

64-bit compilation!

Size of int*: 8 bytes
Size of long: 8 bytes

Disclaimer:

The information provided in this document is intended for your information only. Lubby makes no claims to the validity of this information. Use of this information is at own risk!

About the Author

Author: Wim Peeters - Keskon GmbH & Co. KG

Wim Peeters is electronics engineer with an additional master in IT and over 30 years of experience, including time spent in support, development, consulting, training and database administration. Wim has worked with SQL Server since version 6.5. He has developed in C/C++, Java and C# on Windows and Linux. He writes knowledge base articles to solve IT problems and publishes them on the Lubby Knowledge Platform.