1

Below is a simplest C++ program:

x64test.cpp

int main()
{
    char * p = new char[0xffffffffff]; 
}

My intention is to allocate a big buffer greater than 4G. In a native 64-bit process, it should be OK; but Visual Studio 2011 Beta rejects to compile x64test.cpp and resports: "error C2148: total size of array must not exceed 0x7fffffff bytes".

I have googled and found a useful article at http://blogs.msdn.com/b/windowssdk/archive/2007/09/08/updated-windows-sdk-visual-c-cross-compilers.aspx

According to the article, I should use a native 64-bit compiler to compile x64test.cpp. However, Visual Studio can only be launched as a 32-bit process so that msbuild.exe and cl.exe are always running as 32-bit processes.

I have tried to configure the solution platform to x64, but no effect.

I have used the so-called native 64-bit compiler to successfully compile x64test.cpp by the following steps:

1, start cmd.exe as an administrator;

2, cd C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\amd64;

3, cl x64test.cpp

My question is:

Is there a way to enable the native 64-bit compiler in Visual Studio IDE?

xmllmx
  • 39,765
  • 26
  • 162
  • 323
  • I tied to create x64 configuration from Configuration Manager and it worked just fine (compiled your sample). Checked on VS.10 and VS.11 beta – Alex Z May 25 '12 at 13:32

0 Answers0