G Integrating Pro*C/C++ into Microsoft Visual Studio .NET
This how to integrate Pro*C/C++ into the Microsoft Visual Studio .NET 2002/2003 (or later) integrated development environment.
This the following topics:
Integrating Pro*C/C++ within Microsoft Visual Studio .NET Projects
This section describes how to fully integrate Pro*C/C++ within Microsoft Visual Studio .NET projects.
All the precompiler errors and warnings are displayed in the output box where Microsoft Visual Studio .NET 2002/2003 displays compiler and linker messages. You do not have to precompile a file separately from the Microsoft Visual Studio .NET 2002/2003 build environment. More importantly, Microsoft Visual Studio .NET 2002/2003 maintains the dependencies between .c and .pc files. Microsoft Visual Studio .NET 2002/2003 maintains the dependency and precompile files, if needed.
All of the procedures in this section are performed within Microsoft Visual Studio .NET.
Specifying the Location of the Pro*C/C++ Executable
For Microsoft Visual Studio .NET to run ProC/C++, it must know the location of the ProC/C++ executable. If Microsoft Visual Studio .NET was installed before any Oracle release products were installed, then you must add the directory path.
To specify the location of the Pro*C/C++ executable:
-
Select Options from the Tools menu.
The Options dialog appears.
-
Click the Directories tab.
-
Select Executable files from Show directories For.
-
Scroll to the bottom of the Directories box and click the dotted rectangle.
-
Enter the ORACLE_BASE\ORACLE_HOME
\bindirectory. For example:C:\oracle\ora121\bin -
Click OK.

Description of the illustration ms5.gif
Specifying the Location of the Pro*C/C++ Header Files
To specify the location of the Pro*C/C++ header files:
-
Select Options from the Tools menu. The Options dialog appears.
-
Click the Directories tab.
-
Select Include Files from the Show Directories For list.
-
Scroll to the bottom of the Directories box and click the dotted rectangle.
-
Enter the ORACLE_BASE\ORACLE_HOME
\precomp\publicdirectory. For example:C:\oracle\ora121\precomp\public -
Click OK.
Adding .pc Files to a Project
After you create a project, you need to add the .pc files.
To add a .pc file to a project:
-
Select Add To Project from the Project menu and then select Files. The Insert Files into Project dialog appears.

-
Select All Files from the Files list.
-
Select the .pc file.
-
Click OK.
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:
-
Select Add To Project from the Project menu, and then select Files. The Insert Files into Project dialog appears.
-
Type the name of the
.cfile in the File Name box. -
Click OK. Because the
.cfile has not been created yet, Microsoft Visual Studio .NET displays the following message: “The specified file does not exist. Do you want to add a reference to the project anyway?” -
Click Yes.
Adding the Pro*C/C++ Library to a Project
Pro*C/C++ applications must link with the library file orasql12.lib.
To add the Pro*C/C++ library to a project:
-
Select Add To Project from the Project menu, and then select Files. The Insert Files into Project dialog appears.
-
Select All Files from the Files list.
-
Select orasql12.lib from the ORACLE_BASE\ORACLE_HOME
\precomp\lib\msvcdirectory.
Specifying Custom Build Options

Description of the illustration ms3.gif
To specify Custom Build options:
-
In FileView, right-click a .pc file and select Settings. The Project Settings dialog appears with the Custom Build tab displayed.
-
In the Build commands box, on one line, set the build to use the same hardcoded path as that of the
$ORACLE_HOMEsetting. -
In the Output files box, enter one of the following:
-
If you are generating
.cfiles, then enter$(ProjDir)$(InputName).c. -
If you are generating
.cppfiles, then enter$(ProjDir)$(InputName).cpp.
$(ProjDir)and$MSDEVDIRare macros for custom build commands in Microsoft Visual Studio .NET. When the project is built, Microsoft Visual Studio .NET checks the date of the output files to determine whether they need to be rebuilt for any new modifications made to the source code. -
-
Click OK.
See Also: Microsoft Visual Studio .NET documentation
Adding Pro*C/C++ to the Tools Menu

Description of the illustration ms1.gif
You can include Pro*C/C++ as a choice in the Tools menu of Microsoft Visual Studio .NET.
To add Pro*C/C++ to the Tools menu:
-
From within Microsoft Visual Studio .NET, select Customize from the Tools menu. The Customize dialog appears.
-
Click the Tools tab.
-
Scroll to the bottom of the Menu contents box and click the dotted rectangle.
-
Enter the following text:
Pro*C/C++ -
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\ora121\bin\procui.exe -
In the Arguments box, enter the following text:
$(TargetName)When you select *ProC/C++** from the Tools menu, Microsoft Visual Studio .NET uses the
$(TargetName)argument to pass the name of the current development project to ProC/C++. ProC/C++ then opens a precompile project with the same name as the opened project, but with a.preextension in the project directory. -
In the Initial directory box, enter the following text:
$(WkspDir)The Customize dialog should now look like the following graphic (although the Oracle home directory may be different on your computer).
-
Click Close. Microsoft Visual Studio .NET adds Pro*C/C++ to the Tools menu.