How to Compile 64-bit Code for Windows x64
History
- 7-17-2005: Updated VS6 batch files; added links.
- 5-8-2005: Updated VS6 instructions; added links.
- 5-3-2005: VS6 procedure added.
- 5-2-2005: links & material only.
- 9-25-2006: added replacement setenv.bat.
- 10-3-2007: migrated to wiki.
Things to Download & Install Before Continuing...
Visual Studio 6 Procedure
- For this procedure I use the "64-bit Retail" approach.
- Save the batch files to launch VS6 for your appropriate build target. You may need to edit the paths in them; they assume that VS6 is installed to the default location.
- If you use the Windows DDK, replace "setenv.bat" with this file to keep all other includes & libraries active.
- Launch VS6 from one of the 64-bit batch files.
- Open the project you wish to port.
- "Build" -> "Configurations" -> "Add Project Configuration" -> name it "Retail64" & copy from "Release" settings.
- "Active Configuration" -> "Retail64"
- Set the following in "Project Settings"...
- "General" tab -> change the Intermediate & Output directory names to "Retail64" if you'd like: they default to something odd. If your project is going to be 64-bit only, set them to "Release."
- "C/C++" tab -> "Debug Info" = "Program Database"
- "C/C++" tab -> remove "/GZ" from "Project Options"; replace "/GX" with "/EHsc"; add "/Wp64"; add "/GA" if you're making a Windows application; change "/Gi" to "/Gm" if present; add /GL for link-optimized-code. These changes remove runtime checking, support error-checking, and test for 64-bit compatability; adding "GA" optimizes the program for Windows; changing "Gi" to "Gm" invokes a "minimal rebuild."
- "Link" tab -> change "/machine:I386" to "/machine:IX86" & add "/machine:AMD64" to "Project Options." This enables AMD64 binary compilation. If you used the "GL" switch earler, add "/LTCG" to "Project Options" to complete the support for link-optimized code.
- "Link" tab -> add "bufferoverflowU.lib" to "Object/Library modules." This enables security checking mandated by default in Microsoft's compiler; see "security cookie" error references for information.
You're ready to compile 64-bit code. To verify your application is 64-bit, open Task Manager & look at "Processes:" if your EXE doesn't have a "*32" next to it, its 64-bit.
References
Additional Links
Other
Microsoft is a registered trademark of Microsoft Corporation, and is in no way affiliated with this website.