Skip Headers

Pro*C/C++ Getting Started
Release 9.2 for Windows

Part Number A96111-03
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Feedback

Go to previous page
Previous
Go to next page
Next
View PDF

A Integrating Pro*C/C++ into Microsoft Visual C++

This appendix describes how to integrate Pro*C/C++ into the Microsoft Visual C++ integrated development environment.

This appendix contains these topics:

A.1 Integrating Pro*C/C++ within Microsoft Visual C++ Projects

This section describes how to fully integrate Pro*C/C++ within Microsoft Visual C++ projects.

All the precompiler errors and warnings are displayed in the output box where Microsoft Visual C++ displays compiler and linker messages. You do not have to precompile a file separately from the Microsoft Visual C++ build environment. More importantly, Microsoft Visual C++ maintains the dependencies between .c and .pc files. Microsoft Visual C++ maintains the dependency and precompile files, if needed.

All of the procedures in this section are performed within Microsoft Visual C++.

A.1.1 Specifying the Location of the Pro*C/C++ Executable

For Microsoft Visual C++ to run Pro*C/C++, it must know the location of the Pro*C/C++ executable. If Microsoft Visual C++ was installed before any Oracle release 9.2 products were installed, then you must add the directory path.

To specify the location of the Pro*C/C++ executable:

  1. Choose Options from the Tools menu.

    The Options dialog box appears.

Description of ms5.gif is in surrounding text
  1. Click the Directories tab.

  2. Select Executable files from the Show directories for list box.

  3. Scroll to the bottom of the Directories box and click the dotted rectangle.

  4. Enter the ORACLE_BASE\ORACLE_HOME\bin directory. For example:

    C:\oracle\ora92\bin
    
    
  5. Click OK.

A.1.2 Specifying the Location of the Pro*C/C++ Header Files

To specify the location of the Pro*C/C++ header files:

  1. Choose Options from the Tools menu. The Options dialog box appears.

  2. Click the Directories tab.

  3. Select Include Files from the Show directories for list box.

  4. Scroll to the bottom of the Directories box and click the dotted rectangle.

  5. Enter the ORACLE_BASE\ORACLE_HOME\precomp\public directory. For example:

    C:\oracle\ora92\precomp\public
  6. Click OK.

A.2 Adding .pc Files to a Project

After you create a project, you need to add the .pc file(s).

To add a .pc file to a project:

  1. Choose Add To Project from the Project menu, and then choose Files. The Insert Files into Project dialog box appears.

Description of ms2.gif is in surrounding text
  1. Select All Files from the Files of type list box.

  2. Select the .pc file.

  3. Click OK.

A.2.1 Adding References to .c Files to a Project

For each .pc file, you need to add a reference to the .c file that will result from precompiling.

To add a reference to a .c file to a project:

  1. Choose Add To Project from the Project menu, and then choose Files. The Insert Files into Project dialog box appears.

  2. Type the name of the .c file in the File Name box.

  3. Click OK. Because the .c file has not been created yet, Microsoft Visual C++ displays the following message: "The specified file does not exist. Do you want to add a reference to the project anyway?"

  4. Click Yes.

A.2.2 Adding the Pro*C/C++ Library to a Project

Pro*C/C++ applications must link with the library file orasql9.lib.

To add the Pro*C/C++ library to a project:

  1. Choose Add To Project from the Project menu, and then choose Files. The Insert Files into Project dialog box appears.

  2. Select All Files from the Files of type list box.

  3. Select orasql9.lib from the ORACLE_BASE\ORACLE_HOME\precomp\lib\msvc directory.

  4. Click OK.

A.2.3 Specifying Custom Build Options

To specify custom build options:

  1. In FileView, right-click a .pc file and choose Settings. The Project Settings dialog box appears with the Custom Build tab displayed.

Description of ms3.gif is in surrounding text
  1. In the Build command(s) box, on one line, set the build to use the same hardcoded path as that of the $ORACLE_HOME setting.

  2. In the Output file(s) box, enter one of the following:

    • If you are generating .c files, then enter $(ProjDir)\$(InputName).c.

    • If you are generating .cpp files, then enter $(ProjDir)\$(InputName).cpp.

    $(ProjDir) and $MSDEVDIR are macros for custom build commands in Microsoft Visual C++. When the project is built, Microsoft Visual C++ checks the date of the output files to determine whether they need to be rebuilt for any new modifications made to the source code.

  3. Click OK.


    See Also:

    Microsoft Visual C++ documentation

A.3 Adding Pro*C/C++ to the Tools Menu

You can include Pro*C/C++ as a choice in the Tools menu of Microsoft Visual C++.

To add Pro*C/C++ to the Tools menu:

  1. From within Microsoft Visual C++, choose Customize from the Tools menu. The Customize dialog box appears.

Description of ms4.gif is in surrounding text
  1. Click the Tools tab.

  2. Scroll to the bottom of the Menu contents box and click the dotted rectangle.

  3. Enter the following text:

    Pro*C/C++
  4. In the Command box, type the path and filename of the graphical Pro*C/C++ executable, or use the Browse button to the right of the box to select the file name. For example:

    C:\oracle\ora92\bin\procui.exe
  5. In the Arguments box, enter the following text:

    $(TargetName)

    When you choose Pro*C/C++ from the Tools menu, Microsoft Visual C++ uses the $(TargetName) argument to pass the name of the current development project to Pro*C/C++. Pro*C/C++ then opens a precompile project with the same name as the opened project, but with a .pre extension in the project directory.

  6. In the Initial directory box, enter the following text:

    $(WkspDir)

    The Customize dialog box should now look like the following graphic (although the Oracle home directory may be different on your computer).

Description of ms1.gif is in surrounding text
  1. Click Close. Microsoft Visual C++ adds Pro*C/C++ to the Tools menu.