Develop 64-bit applications on 32-bit windowsProgram
Create 2011-9-2
Sometimes you need to develop a Windows 64-bit application, but do not want to install a 64-bit operating system. Therefore, you need to develop a 64-bit application in a 32-bit system. The steps are not complex.
Take Windows XP 32-bit system and Visual Studio 2008 as an example. First, ensure that the x64 compiler and tool under Visual C ++ are selected during installation.
After installation, run the Visual Studio 2008x64 compatible tool command prompt under Visual Studio 2008 \ Visual Studio Tools in the program.
1. Use the CL (Link) command in the command line for compilation. cl generally automatically calls link. For example:
CL first64test. CPP/ESCs
Select the necessary header files and library files as needed. For more information about the options, see the help of Cl. Finally, 64-bit EXE is compiled and copied to the target computer of the 64-bit operating system for running.
2. Build in integrated development environment (IDE)
Run the/useenv command to start IDE, such as devenv/useenv. The first startup will create an x64 solution platform, which can be directly started in the graphic interface later
Create a new project and select "Configuration Manager" under "generate ". In the activity solution platform drop-down list, choose new> x64, choose new> x64 from the project platform drop-down list, or select the project platform first, then, select the new solution ticket scheduler.
AddSource codeFile, configure the necessary header files and library files, and configure the following for 64-bit
1. Click "project" \ "properties" in the menu to open "Configuration Manager" \ "C ++" \ "General ", determine "Check 64 portability" to "Yes (/wp64)" to ensure the compiler checks 64-bit portability of the project.
2. In "linker" \ "advanced", change "target computer" to "not set". Then, click "command line" on the left ", add "/machine: amd64" to "additional options ".
3. compile and generate 64-bit EXE,
4. Copy the application to the target computer of the 64-bit operating system. Because the program files compiled by IDE use the manifest method to specify the DLL files. Therefore, if it is a dynamic link to the Runtime Library, You need to copy the application library file and Microsoft Visual Studio 9.0 \ Vc \ redist \ amd64 \ Microsoft. vc90.crt \ Microsoft. vc90.crt. manifest and its dynamic libraries to the target machine; otherwise, modify the compilation option and change/MD or/MDD to/Mt or/MTD, so that the static link to the VC Runtime Library is realized, the vc dll is no longer needed at runtime.