RE: VS6 and intel C++ 8.0 - how to compile for WIN64?

From: Tim Macaulay[MSFT] (timmac_at_online.microsoft.com)
Date: 04/26/04

  • Next message: OvErboRed: "Backward Compatibility?"
    Date: Mon, 26 Apr 2004 19:45:18 GMT
    
    

    Hi Benjamin,

    See if this helps out at all.

    SUMMARY
    =======

    This step-by-step article describes how to use the Microsoft Visual Studio
    IDE to build 64-bit applications while you maintain the same code base for
    both 32-bit and 64-bit development. To maintain the same code base, you use
    two different build configurations.

    Because the native 64-bit IDE is still under
            development, no IDE exists for 64-bit development. The current
    Software
            Development Kit (SDK) includes the compiler, the linker, and other
    tools for
            64-bit development. The SDK also includes the C-Runtime (CRT)
    library, the
            Microsoft Foundation Classes (MFC), and the Active Template Library
    (ATL)
            versions for 64-bit production.

    You can use either the Microsoft Visual
            C++ 6.0 or the Microsoft Visual C++ .NET IDE to build 64-bit
    applications. This is useful if
            you have an existing 32-bit application and you want to migrate it
    to a 64-bit
            application. This article describes how to perform a 64-bit build
    as a
            different build configuration of the same project.

    #toc: back to the
                      top

    Requirements
    ------------

    The following list
            outlines the recommended hardware, software, network
    infrastructure, and
            service packs that you need:
            
    - Microsoft Platform SDK of November 2001 or later
    - Visual C++ 6.0 or Visual C++ .NET (2002 or 2003)

    #toc: back to the
                      top

    Build a 64-Bit Application by Using the Visual C++ 6.0 IDE
    ----------------------------------------------------------

    Set the 64-Bit Build Environment
                                    Variables

    To set the 64-bit build environment variables, use either of the following
    methods:
            

    - Click "Start", point to "Microsoft Platform SDK", point to "Open
      Build Environment Window", point to "Set Windows XP 64 Build
      Environment", and then click "Set Windows XP 64 Build Environment
      (Debug)". A console window with the build environment set for a 64-bit
      build is displayed.

    - To set the 64-bit environment variables at the command
                prompt, follow these steps:
                

            1. Click "Start", and then click
                                    "Run".

            2. Type "command.exe" (without the quotation marks), and then click
                                    "OK".

            3. Change the folder to C:\Program Files\Microsoft SDK,
                                    and then type "SetEnv.bat /XP64" (without the quotation
    marks).

    #toc: back to the
                      top

    Start Visual C++ 6.0 with a 64-Bit Build Environment

    1. In the the same command window where you set the environment
       settings for 64-bit SDK, open Visual Studio.

    2. Type "Msdev /useenv" (without the quotation marks). Do not open a
       new command window to open MSdev.exe.. The Visual C++ 6.0 IDE is
       displayed, but the include, the library, and the executable directories
       are set for a 64-bit build environment. Note If Msdev.exe is not in the
       path, change the folder to the \Microsoft Visual
       Studio\Common\Msdev98\Bin folder before you run Msdev.exe.

    #toc: back to the
                      top

    Add a 64-Bit Debug Configuration

    1. In the Visual C++ IDE, open an existing 32-bit project (for example,
       MyApplication).

    2. On the "Build" menu, click "Configurations".

    3. In the "Configurations" 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.

    5. To add the configuration, click "OK", and then click "Close".

    #toc: back to the
                      top

    Set the Active Configuration to 64 Bits

    1. On the "Build" menu, click " Set Active Configuration".

    2. Click "MyApplication- Win32 Debug64", and then click "OK".

    #toc: back to the
                      top

    Modify Compiler or Linker Options

    Several Visual C++ 6.0 compiler or linker options do not apply to
            the 64-bit compiler or to the linker. To modify these options,
    follow these steps:
            

    1. On the "Project" menu, click "Settings".

    2. In the "Project Settings" dialog box, click the "General" tab. Under
       "Output directories", type "Debug64" (without the quotation marks) in
       the "Intermediate files" and "Output files" boxes.

    3. On the "C/C++" tab, select "Program Database (compiler option, /Zi)"
       in the "Debug info" list.

    4. On the "Link" tab, change "/machine:I386" (without the quotation
       marks) to "/machine:IA64" (without the quotation marks) in the "Project
       options" box.

    5. On the "View" menu, click "Workspace".

    6. To delete the MyApplication.hpj file from the project, click the
       "MyApplication.hpj" file in the Workspace window, and then press DEL.
       Note This file may already be removed.

    7. If your application is an MFC application, you must add an
                MFC path to avoid receiving Linkers Tool Error LNK1104 on the
    Mfc42d.lib
                file. To add an MFC path, follow these steps:

            a. On the "Tools" menu, click
                                    "Options".

            b. On the "Directories" tab, select
                                    "Library Files" in the "Show directories" list.
                                    Add the "\Microsoft SDK\lib\IA64\mfc" (without the
    quotation marks) path if it is not
                                    listed.

    #toc: back to the
                      top

    Build and Then Debug the Project

    1. Build the project. Now you have a 64-bit application that is ready
       to be deployed to an IA64 computer.

    2. To run the .exe file from the Visual C++ 6.0 IDE, follow these
                steps:

    Note You cannot debug the .exe file from the Visual C++ 6.0 IDE.
                

            a. Create a folder that is named C:\VC6MSVCMON on the
                                    IA64 computer. Copy the following files from the x86
    computer to this new
                                    folder:
                                    
                    - Msvcmon.exe
                    - Dm.dll
                    - Msdis110.dll
                    - Tln0t.dllThese files are located in the
                                    \VisualStudio\Common\MSDev98\Bin
                                    folder.

            b. After you copy the files, run Msvcmon.exe on the IA64
                                    computer, and then click "Connect".

            c. In the Visual C++ 6.0 IDE on the x86 computer, click
                                    "Debugger Remote Connection" on the "Build" menu.
                                    

            d. In the "Remote Connection" dialog box, click
                                    "Network TCP/IP", and then click "Settings".
                                    

            e. In the "Target computer name or address"
                                    box, type the name of the IA64 computer. To close the
    dialog box, click
                                    "OK" two times.

            f. In the Visual Studio C++ IDE, click
                                    "Settings" on the "Project" menu. In the left pane,
    expand "MyApplication", and then click the
                                    "Debug" tab. You will notice that the "Executable for
                                    debug session" box contains the path of
    MyApplication.exe. This will be
                                    C:\<X86Path>\MyApplication.exe.
                                    

            g. In the "Remote executable path and file
                                    name" box, type "MyApplication.exe" (without the
    quotation marks) with a full path. This full path looks like
                                     "\\<X86ComputerName>\C$\<x86Path>\MyApplication.exe"
    (without the quotation marks).
                                    Click "OK" to close the window.

            h. To run the .exe file, press CTRL+F5 or click "Execute
                                    MyApplication.exe" on the "Build" menu. The .exe file
    runs on
                                    the IA64 computer.

    Note If MyApplication is an MFC application and if the project uses
            MFC .dll files, make sure that the .dll files are copied from the
    \Microsoft
            SDK\NoRedist\Win64 folder to the \System32 folder on the IA64
    computer. These
            are the .dll files:
            
    - Mfc42d.dll
    - Mfco42d.dll
    - Msvcrtd.dll

     This folder also contains the symbols for the MFC, the ATL, and
            the MSVCRT debug and release versions.

    #toc: back to the
                      top

    Build a 64-Bit Application by Using the Visual C++ .NET IDE
    ------------------------------------------------------------

    Warning Do not install the 64-bit version of the WinDbg debugging tool
            on the same computer where Visual Studio .NET is installed. For more
            information about the 64-bit version of WinDbg,
            read the Platform SDK 64-bit Readme. The Readme is located at
    C:\Program
            Files\Microsoft SDK\Bin\Win64\Readme.doc.

    Set the 64-Bit Build Environment
                                    Variables

    To set the 64-bit build environment variables, use either of the following
    methods:
            

    - Click "Start", point to "Microsoft Platform SDK", point to "Open
      Build Environment Window", point to "Set Windows XP 64 Build
      Environment", and then click "Set Windows XP 64 Build Environment
      (Debug)". A console window with the build environment set for a 64-bit
      build is displayed.

    - To set the 64-bit environment variables at the command
                prompt, follow these steps:
                

            1. Click "Start", and then click
                                    "Run".

            2. Type "command.exe" (without the quotation marks), and then click
                                    "OK".

            3. Change the folder to the \Microsoft SDK folder, and
                                    then type "SetEnv.bat /XP64" (without the quotation
    marks).

    #toc: back to the
                      top

    Start Visual C++ .NET with a 64-Bit Build Environment

    1. In the the same command window where you set the environment
       settings for 64-bit SDK, open Visual Studio .NET.

    2. Type "devenv /useenv" (without the quotation marks), and then click
       "OK". The Visual C++ .NET IDE with the include, the library, and the
       executable directories set for a 64-bit build environment is displayed.
       Note If Devenv.exe is not in the path, change the folder to the
       <InstallationFolder>\Microsoft Visual Studio .NET\Common7\IDE folder
       before you run Devenv.exe. Warning After you run this command, every
       console window or Visual Studio .NET IDE that you open has the 64-bit
       build environment. If you want to clear the environment, delete the
       Vccomponents.dat file from the C:\Documents and
       Settings\<Username>\Local Settings\Application
       Data\Microsoft\VisualStudio\7.0 folder before you open a new console
       window or a new Visual Studio .NET IDE.

    #toc: back to the
                      top

    Add a 64-Bit Debug Configuration

    1. Open an existing 32-bit project (for example, MyApplication).

    2. On the "Build" menu, click " Configuration Manager".

    3. In the "Active Solution Configurations" list, click "New".

    4. In the "New Solution Configuration" dialog box, select "Debug64"
       (without the quotation marks) under "Solution Configuration Name", and
       then select "Debug" under "Copy Settings From".

    5. Click "OK".

    6. In the "Configuration Manager" dialog box, click to select "Debug64"
       in the "Active Solution Configuration" list, and then click "OK".

    #toc: back to the
                      top

    Modify Compiler or Linker Options

    Several Visual C++ .NET compiler or linker options do not apply
            to the 64-bit compiler or linker. To modify these options, follow
    these steps:
            

    1. In Solution Explorer, right-click "Project", and then click
       "Properties".

    2. In the "C/C++" node, select "General". Set "Debug Information
       Format" to "Program Database (compiler option, /Zi)".

    3. In the "C/C++" node, select "Code generation". Set "Buffer Security
       Check" to "No (compiler option, /GS)".

    4. In the "Linker" node, select "Command Line". Under "Additional
       Options", add "/MACHINE:IA64" (without the quotation marks).

    5. If your application is an MFC application, you must add an
                MFC path to avoid receiving Linkers Tool Error LNK1104 on the
    Mfc42d.lib
                file. To add an MFC path, follow these steps:

            a. On the "Tools" menu, click
                                    "Options".

            b. Under "Projects", select "VC++
                                    Directories". On the "Show directories" list, select
    "Library Files". If it is not listed, add the
                                     "\Microsoft SDK\lib\IA64\mfc" (without the quotation
    marks) path. Note If MyApplication is an MFC application and the project
    uses MFC .dll
                files, make sure that the .dll files are copied from the
    \Microsoft
                SDK\NoRedist\win64 folder to the \System32 folder on the IA64
    computer. These
                are the DLLs:
                
            - Mfc42d.dll
            - Mfco42d.dll
            - Msvcrtd.dllThis folder also contains the symbols for the MFC, ATL, and
                MSVCRT debug and release versions.

    #toc: back to the
                      top

    Build the Project

    Build the project. Now you have a 64-bit application that is ready
            to be deployed to an IA64 computer.

    Note Although you can run the .exe file from Visual C++ 6.0 IDE, you
    cannot, you cannot run the .exe file from the
            Visual C++ .NET IDE. Also, you cannot debug the .exe file from the
    Visual C++ .NET
            IDE.

    Tim Macaulay
    Microsoft Corp.
    This posting is provided "AS IS" with no warranties, and confers no rights


  • Next message: OvErboRed: "Backward Compatibility?"

    Relevant Pages

    • Re: porting 32-bit to 64-bit on Xeon
      ... IDE to build 64-bit applications while you maintain the same code base ... To set the 64-bit build environment variables, ... Build Environment Window", point to "Set Windows XP 64 Build ... change the folder to the \Microsoft Visual ...
      (microsoft.public.vc.mfc)
    • Re: porting 32-bit to 64-bit on Xeon
      ... IDE to build 64-bit applications while you maintain the same code base ... Set the 64-Bit Build Environment ... Build Environment Window", point to "Set Windows XP 64 Build ... change the folder to the \Microsoft Visual ...
      (microsoft.public.vc.language)
    • Re: porting 32-bit to 64-bit on Xeon
      ... > Set the 64-Bit Build Environment ... > Build Environment Window", point to "Set Windows XP 64 Build ... > Add a 64-Bit Debug Configuration- ... > to be deployed to an IA64 computer. ...
      (microsoft.public.vc.mfc)
    • Need help ASAP. Problems importing a form
      ... I work with a test database environment to develop or ... to the production db by opening the production db front ... Objects' window opened, I selected the form to import. ... I have been using this 'develop and import' environment ...
      (microsoft.public.access.externaldata)
    • Re: Which is the best open source C/C++ IDE out there?
      ... > I'm not a real programmer, ... > It's a tool based environment. ... > - Compiler with a debugger. ... > IDE vs. Toolbased Environments ??? ...
      (freebsd-questions)

  • Quantcast