Programs developed under vc6.0 run on 64-bit machines

Source: Internet
Author: User

This article describes how to use Microsoft Visual Studio ide To create a 64-bit application, and the 64-bit application code is exactly the same as the 32-bit application code, the compilation environment configuration is different. No pure 64-bit ide application development environment has been found. When I translate this article, Microsoft has provided a 64-bit Creation environment in vs. net2002/2003/2005/2008 IDE, but the entire 64-bit IDE development environment does not seem to be available. If you are interested, you can see:

Http://blogs.msdn.com/deeptanshuv/archive/2006/04/11/573795.aspx

Http://forums.msdn.microsoft.com/en-US/netfx64bit/threads/

The current software development kit (which should be Microsoft SDK 2003 Server RC2) includes compilers, connectors, and other tools designed for 64-bit applications. similarly, this SDK contains the C Runtime Library (CRT), Microsoft basic library (MFC), and the Active Template Library (ATL), which are all 64-bit product versions. you can use visual c ++ 6.0 or visual C ++.. Net ide creates a 64-bit application. If you have a 32-bit application and want to port it to a 64-bit application, this article describes how to create a 64-bit configuration environment in the same project.

Some necessary conditions
The following list describes the recommended hardware, software, network, and Service Pack:
Microsoft platform SDK (2001/11) or recently released Microsoft platform SDK: 2003 SDK RC2 is recommended ,:

Http://download.microsoft.com/download/0/8/3/0839ce16-0523-4407-9432-01958ee61aff/VS2008TeamSuite90DayTrialCHSX1429243.part1.rar

......

Http://download.microsoft.com/download/0/8/3/0839ce16-0523-4407-9432-01958ee61aff/VS2008TeamSuite90DayTrialCHSX1429243.part7.rar

Visual c ++ 6.0 or visual C ++. Net (2002 or 2003 or 2005 or 2008)

Use Visual C ++ 6.0 IDE to create a 64-bit Application

Set 64-bit to create environment variables in any of the following ways:
Method 1:

Click the Start menu and point to Microsoft platform SDK> open Build Environment Windows> set Windows XP 64 build environment ", click "set Windows XP 64 Build Environment (Debug)". A console window will display a line of text like "The Build Environment set for a 64-bit ".

Method 2:
At the command prompt,
1. Click the Start menu and then click Run"

2. Click "Export command.exe" (no quotation marks), and then click "OK"

3. Change the current directory to c: \ Program Files \ microsoft SDK (your SDK installation directory), and then type "setenv. BAT/xp64" (no quotation marks)

Start visual c ++ 6.0 and use the environment we Just configured
1. Open Visual Studio in the same command window (that is, the command line window in which you just set the 64-bit environment.

2. type "msdev/useenv" (no quotation marks ). please note that do not open a new command line window, and then open msdev.exe. Now visual c ++ 6.0 IDE is displayed and include, the Library and executable directories are both set to 64-bit creation environments (Note: to view these configurations, Click Tools> Options> directories, in the "show directories: "view the corresponding directory configuration in the drop-down list ).
In addition, if msdev.exe is not in the current path (usually the system environment variables do not have the corresponding instructions), change the directory to the directory where Visual Studio is installed. For example: \ Microsoft Visual Studio \ common \ msdev98 \ bin, and then press msdev.exe.

Note: In the previous settings, the 64-bit environment variable has been created. The Executable Directory of IDE has been adjusted to the corresponding directory of the SDK, that is, as an executable program: the compiler and the linker are in the SDK directory instead of the Default \ Microsoft Visual Studio \ common \ msdev98 \ bin

Add a 64-bit debug Configuration
1. Open a 32-bit project (for example, myapplication) in Visual C ++ IDE)

2. on the "build" menu, click "deployments ".

3. In the "deployments" dialog box, click "add ".

4. In the "add project configuration" dialog box, set "configuration" to debug64, and then click "myapplication-Win32 debug" in the "Copy settings from" list box"

5. Click "OK" to complete the settings and click "close" to close the settings.

Set the activation configuration to 64-bit
1. Click "set Active configuration" in the "build" menu ".

2. Click "myapplication-Win32 debug64", and then click "OK ".

Modify the parameter configurations of the compiler and linker
Because the parameter configurations of the 64-bit compiler and the linker are different from those of the 32-bit compiler, we need to modify some options. The following are the configuration steps:
1. Click settings in the project menu ".

2. in the Project Settings dialog box, click the General tab. in "output directories", in the "intermediate files" and "output files" input boxes, type "debug64" (no quotation marks)

3. On the "C/C ++" tab, select "program database" in the "debug info" drop-down list (the parameter option corresponds to/Zi)

4. On the "Link" tab, in the "Project Options" input box, change "/machine: i386" (no quotation marks) to "/machine: IA64" (no quotation marks)

The correct setting should be:/machine: amd64

5. Click workspace in the View menu ".

6. Then, remove the Help File myapplication. HPJ.

7. If your application is based on MFC, you must add an MFC path to avoid Link errors: lnk1004 on the mfc42d. Lib. follow these steps:
A. Click "options" on the "Tools" menu ".

B. on the "directories" tab, select "library files" in the "show directories" drop-down list and add the path of your platform Library: "\ microsoft SDK \ Lib \ IA64 \ MFC" (no quotation marks)

On the "C/C ++" tab, change Win32 to win64 in the "Preprocessor definitions" input box.
Create and debug this project
Now build this project to generate a 64-bit application deployed on an IA64 computer.
To run this. EXE file in Visual C ++ 6.0, follow these steps:
Note: you cannot upload this. EXE file in Visual C ++ 6.0 ide.aliyun.com.
A. Create a folder C: \ vc6msvcmon on your IA64 computer.
Copy these files from an x86 (32-bit) computer to the newly created Folder:

Msvcmon.exe
DM. dll
Msdis110.dll
Tln0t. dll

The above files should be in your visual C ++ 6.0 installation directory:
\ Visual Studio \ common \ msdev98 \ bin

B. After copying these files, run msvcmon.exe ON THE ia64computer, and then click Connect ".

C. On the x86 (32-bit) Computer, open visual c ++ 6.0 IDE and click debugger remote connection in the "build" menu ".

D. In the "remote connection" dialog box, click "Network TCP/IP", and then click "Settings ".

E. In the "target computer name of address" input box, type the name of the IA64 computer. Click "OK" twice to close the dialog box.

F. in Visual Studio C ++ IDE, click "Settings" in the "project" menu, expand "myapplication" in the left-side pane, and click the "debug" tab. you will notice that the "executable for debug session.exe" input box contains the path of myapplication.exe, which looks like c: \ <x86path> \ myapplication.exe.

G. in the "remote executable path and file name" input box, click the full path where myapplication.exe "(without double quotation marks) is located. The path looks like: \ <x86computername> \ C $ \ <x86path> \ myapplication.exe (no quotation marks ). click "OK" to close the window.

H. Press Ctrl + F5 or click execute myapplication.exe on the "build" menu to start and run the. exe file. the. exe file is now running on the IA64 computer.
NOTE: If myapplication is an MFC Application and this project uses MFC-related. DLL files, please be sure on the IA64 computer, those. the DLL file has been copied from the \ microsoft SDK \ noredist \ win64 folder to the \ system32 folder.
Note: \ microsoft SDK \ noredist \ win64 stores debug and release versions of MFC and ATL-related DLL (64-bit). You can also copy these dllfiles to the same directory where your executable .exe file is located.
These DLL files are:

Mfc42d. dll
Mfco42d. dll
Msvcrtd. dll

Problems frequently encountered in compilation/link:

Link errors, usually RTC and cookie errors. For more information, see the following link settings:

Http://support.microsoft.com /? SCID = kb % 3ben-us % 3b894573 & X = 15 & Y = 14

Error spawing bscmake.exe appears in the Link
Deselect the check box for the compilation parameter (Project Settings> C/C ++): Generate browse info
If it still fails, check the menu items "Tools"> "options", locate the "directories" tab, and select "executable files". In the following directory list, place the <SDK installation directory> \ bin path in the first item. (The 64-bit compiler and the linker in this directory will reload the old 32-bit settings ).
If you are connecting a dynamic library to the main application, you must use the same Runtime Library. For example, all are multi-threads DLL (click "project"> "Settings ", select the "C/C ++" label, select "code generation" from the "category" drop-down list, and select from the "use Runtime Library" drop-down list below ).
Use Visual C ++. Net ide To create a 64-bit Application
Warning after Visual Studio is installed.. net. Do not install the 64-bit windbg debugger tool on the computer. Read the readme.doc of the platform sdk( in C: \ Program Files \ microsoft SDK \ bin \ win64 \ readme.doc ).
Set 64-bit to create environment variables in any of the following ways:
Refer to the same section above.
Start visual c ++. NET and use the 64-bit environment we just created
1. In the command line window set in the 64-bit SDK environment, open Visual Studio. NET.

2. Type "devenv/useenv" (no quotation marks) and click "OK". Now the include, library, and executable directories are set to the directory where the 64-bit SDK is located.

NOTE: If devent.exe is not in the current path (Visual Studio is not specified in the path of the system environment variable.. net installation directory), change the folder path to <Visual Studio. net installation directory> \ Microsoft Visual Studio. net \ common7 \ IDE, and then run the above command.
Warning after you run this command, Visual Studio. net IDE is set to a 64-bit development environment. If you want to clear this environment, open a new Visual Studio. before. Net IDE, delete vccomponents under c: \ Documents and Settings \ <username> \ Local Settings \ Application Data \ Microsoft \ visualstudio \ 7.0. DAT file.

Add a 64-bit debugging Configuration
1. Open an existing 32-bit project (for example, myapplication ).

2. Click "Configuration Manager" on the "build" menu ".

3. In the "Active solution deployments" list, click "new ".

4. in the "New Solution configurations" dialog box, under "solution configuration name", select "debug64" (excluding quotation marks), and under "Copy settings from", select "debug ".

5. Click "OK ".

6. In the "Configuration Manager" dialog box, in the "Active solution configuration" list, click and select "debug64", and then click "OK ".

Modify compiler and linker settings
Because the parameter configurations of the 64-bit compiler and the linker are different from those of the 32-bit compiler, we need to modify some options. The following are the configuration steps:

1. In the solution window, right-click Project and click Properties ".

2. on the "C/C ++" node, select "general". Set "debug information format" to "program database" (the corresponding compilation option is/Zi ).

3. On the "C/C ++" node, select "code generation". Set "buffer security check" to "no" (the corresponding compilation option is/GS ).

4. On the linker node, select "command line". Under "Additional Options", add "/machine: IA64" (no quotation marks ).

5. If your application is based on MFC, you must add the MFC path to avoid the Link error: lnk1104 on the mfc42d. Lib file.
To add an MFC path, follow these steps:
A. Click "options" on the "Tools" menu ".

B. under projects, select VC ++ directories ". in the "show directories" list, select "library files ". if the library path is not listed, add the library path "\ microsoft SDK \ Lib \ IA64 \ MFC" (no quotation marks ).
NOTE: If myapplication is an MFC Application and this project uses MFC-related. DLL files, please be sure on the IA64 computer, those. the DLL file has been copied from the \ microsoft SDK \ noredist \ win64 folder to the \ system32 folder.
These DLL files are:
Mfc42d. dll
Mfco42d. dll
Msvcrtd. dll

After completing these steps, you can build a 64-bit executable program.
For more information about the debugging project, see visual c ++ 6.0 IDE.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.