Using the Pro*C/C++ Precompiler
After starting the Pro*C/C++ precompiler, click on the the Preferences
menu item and select Default Output C++ File Name
Select Edit/Add and key in the source file name in the Input
File dialog box.
Highlight the entry for the file added above and select Edit/Options
from the menu.
In the Options dialog box:
- in the Code box, set the Parse entry to Partial, the Code entry
to CPP and the Mode entry to ANSI.
- in the Include Directories entry, enter the directory of the C++
include files: for Visual C in the labs, enter:
"C:\Program Files\Microsoft Visual Studio\VC98\Include"
- Note: the quotes are necessary because of the spaces in
the path.
To precompile, select File/Precompile from the menus.
If the compilation is successful, a green check mark will appear in
the left-most column. A file the same name as the source code and
with extension
cpp will be created.
If the compilation fails, a red X will appear. To view the
error messages, double click on the X.
To save the project, select File/Save from the menus.
The project will be saved with an extension pre.
Using Visual C++6 to Compile and Link the Program
Start Visual C++6.
Step 1: Creating a Project
- Select New from the File menu; click on
the Projects tab in the dialog box
- Select Win32 Console Application from the list
- In the Location box, type the path to the directory that
contains the source file, but do not type the directory name itself
- Enter the name of the directory containing the source file in
the Project Name box
- Make sure the Create New Workspace radio button is
checked and click the OK button
- the Win32 Console Application box will be
displayed; make sure the An Empty Project radio button is
checked
- click the Finish button and the OK button
Step 2: Adding files to the Project
You must add your C++ source file and the Pro*C/C++ library to the
project.
To add the source file:
- Select Add to Project from the Project menu
- Click on Files and select the source file
- Click the OK button
To add the Pro*C/C++ library:
- Select Add to Project from the Project menu
- Click on Files
- Select All Files from the Files of type list box
- Select oraSQL9.LIB from the C:\ORACLE\ORA92\PRECOMP\LIB\MSCV
directory
- Click the OK button
Step 3: Specifying the location of the Pro*C/C++ Header Files
- Choose Options from the Tools menu
- Click on the Directories tab in the Options
dialog
box
- Select Include Files from the Show directories for
list box
- Scroll to the bottom of the Directories box and click
the
dotted rectangle
- Enter: C:\ORACLE\ORA92\PRECOMP\PUBLIC
- Click the OK button
To compile and link, select Build from the Build menu.
Executing the Program
Select Execute from the Build menu.