Oracle
Pro*C/C++(TM) Getting Started for Windows Platforms Release 8.0 A53634-01 |
|
This chapter explains how to create and precompile a project. It also describes the Pro*C/C++ graphical interface, which you use to execute commands with Windows menus and icons or with keyboard equivalents.
This chapter includes:
Note:
For information about integrating Pro*C/C++ into Microsoft Visual C++, refer to Appendix A. For more information about integrating Pro*C/C++ into Borland C++, refer to Appendix B. |
Installing Oracle software creates a directory structure on your hard drive for your Oracle products. A main directory-the Oracle home directory-holds the Oracle subdirectories and files that are necessary to run Pro*C/C++.
Note:
The following diagram illustrates the directory structure for Windows NT. This directory structure is similar for Windows 95. |
In this example, the default Oracle home directory for Windows NT is \ORANT.
The subdirectories in \ORANT hold the Pro*C/C++ executable files and the library files.
The letters nn represent the version of the product installed. For example, if you have already installed Pro*C/C++ Version 3.0, you have a \PRO30 subdirectory under \ORANT. If you now install Pro*C/C++ version 8.0, Oracle Installer adds a \PRO80 subdirectory.
The subdirectories in the Oracle home directory, include:
Based on the supported products you choose to install, Oracle Installer also creates the appropriate product subdirectory. For example, when you install Pro*C/C++, Release 8.0, the Oracle Installer creates the \PRO80 subdirectory, which contains files and subdirectories for Pro*C/C++.
Under the \PRO80 subdirectory, you find the following subdirectories:
The Pro*C/C++ installation procedure copies a set of 32-bit sample programs and their corresponding .DSP and .IDE files into the \PRO80\C\SAMPLES (for Windows NT and Windows 95) directory. Samples can be found in their corresponding subdirectories. Oracle recommends that you build and run these sample programs to verify that Pro*C/C++ has been installed successfully and operates correctly.
Additional
Information:
See "Building and Running Sample Programs" in Chapter 3. |
Before you follow the instructions for creating and precompiling a Pro*C/C++ project, you may wish to familiarize yourself with the basic commands, dialog boxes, menus, and buttons for the Pro*C/C++ graphical interface.
Start the Pro*C/C++ Application Window by clicking on its icon in the Oracle for Windows NT program group or typing procui80.exe at the command line.
Use the Pro*C/C++ Application Window to create a Pro*C/C++ project. This window contains five elements.
Displays Pro*C/C++ and the name of your precompile project. If you have not assigned a name to the current project, the word "Untitled" appears instead.
When you select an item on the Menu bar, a list box of command options drops down. The Menu bar contains the following menus:
Enables you to execute commands without navigating through menus or typing on the keyboard.
The Pro*C/C++ Application Window displays information about the precompilation status.
Element | Explanation |
---|---|
Precompilation Status Bar |
Shows the results of your precompilation. Look for one of the status icons in the precompile status bar once the precompile process is complete. |
Double clicking on the status icon opens the Precompilation Status dialog message box. This message box provides detailed information on the status of the precompiled file.
To create and compile a project, you must:
The Pro*C/C++ Application Window opens only one project at one time. A project may consist of one or more precompilable files.
To begin using Pro*C/C++, select the Pro*C/C++ icon from the Oracle for Windows NT programs menu. The Pro*C/C++ Application Window appears.
Create a new project by clicking the New button. To open an existing project, click the Open button.
Use the Preferences menu to choose the manner in which a name is assigned to the output file. The setting only affects to-be-added input files. An existing output file name will not be changed. However, you can change an output file name manually by double-clicking on the output file and entering a new name.
When you select the Default Output File Name toggle command, a checkmark 3 appears, and the system assigns a default output filename. In this case, the output file has the same name as the input file, except for the extension. For example, if you select winsam.pc from the Input File dialog box, the name in the Output File dialog box defaults to winsam.c (for C) and . winsam.cpp (for C++).
If you turn off the 3 Default Output File Name, the checkmark disappears. In this case, when you select an input file, the Output File dialog box appears.
Enter an output filename for each file selected. Once you select or enter a filename, it appears in the Output File dialog box.
To create a list of files to be precompiled, do one of the following:
The Input File dialog box appears:
Select one or more files from the File Name list box. If the file you want resides in a different drive or directory, use the Drives and Directory list boxes to locate it, or enter the filename with the full path name in the File Name text field.
Select (or enter) the files, then click on the Open button in the Input File dialog box. All selected files appear in the Input File of the Pro*C/C++ Application Window.
To delete files from the precompile list, first select a file(s), then choose the Delete button (or equivalent). The highlighted file-both the input file name and the output file-disappears from the list. You can select and delete one or several files at a time.
To set precompile options, highlight one or more files in the Input File list (this enables the Options button in the toolbar, and the Options item in the Edit menu), then do one of the following:
The Options dialog box appears:
Use this dialog box to specify options for precompiling a file. You can activate (or change) options in one of three ways:
Default options are in effect for all newly added files. When you change an option's default setting, a description of the change appears in the Option String edit field (at the bottom of the screen) and in the Options information window (in the Application dialog box).
Note:
The Parse option default setting is "none" and the Code option default setting is "ANSI_C". |
Some options are numeric. These fields accept integers between 0 and 999, although some options have valid ranges. Nonvalid characters (such as letters in a numeric field) do not appear in the Option String edit field. If you enter nonnumerical characters (or nothing) in a numeric edit field, default settings are restored when you exit that field.
Additional
Information:
Four of the options are described in this section. For a description of the other options, see the Programmer's Guide to the Oracle Pro*C/C++ Precompiler. |
Use this field to enter INCLUDE path directories. If you want to enter more than one, separate each path with a semicolon, but do not have a space after the semicolon. This causes a separate "includes=" string to appear in front of each directory.
For samples that precompile with parse=partial or parse=full, an include path of C:\PROGRAM FILES\DEVSTUDIO\VC\INCLUDE has been added by default. If Microsoft Visual C++ has been installed at a different location or if Borland C++ is used, modify the Include Directories input field accordingly for the samples to precompile without errors.
To change the settings, which effect the format of the output list file that the precompiler writes to disk, click the Listing/Errors button. The Listing/Errors dialog box appears:
Use this dialog box to change the settings, such as the type of error information generated and the name of the list file, which effect the format of the output list file that the precompiler writes to disk.
Additional
Information:
For more information, see the Programmer's Guide to the Oracle Pro*C/C++ Precompiler. |
After you set the options, choose OK to return to the Pro*C/C++ Application Window. Any option you changed from its default value appears as a command line string in the Options information pane.
If you selected semantic or full for the SQLCHECK option in the Options dialog box, you may need to specify a database connection information to the Oracle database. You do not need to connect to the Oracle database if every table referenced in a data manipulation statement or PL/SQL block is defined in a DECLARE TABLE statement.
After you return to the Pro*C /C++ Application Window, select Connect from the File menu. The Connect dialog box appears.
Use this dialog box to specify a database connection information prior to precompiling (no database connect is performed at this time). Only one database connection information can be specified for all files requiring semantic or full SQLCHECKing.
The Connect dialog box appears automatically at precompile time if you have not previously responded. Type the username, the password, and the connect string (not required for local database). Then choose OK.
If you want to save the Connect information between Pro*C/C++ sessions, select the Save Connect String to Disk check box. If you do not select the check box, no fields are stored, and you must enter this information each time you precompile with Pro*C/C++.
You can precompile any number of files in the list. To precompile one or more files, first select the appropriate files from the list, then choose Precompile. To precompile the selected files, do one of the following:
When precompiling is completed, the message in the dialog box says "Precompiling Finished", and the Cancel button changes to OK. Choose OK to continue.
Note:
Although Cancel does not interrupt the precompile for a file already in process, it does halt the precompile chain for remaining files. |
Precompiling can result in success, success with warning(s), or failure. When precompiling is finished, check the Precompilation Status Bar. If all your files precompiled successfully, you see only green checkmarks. A yellow checkmark means success with warnings, while a red checkmark means that there are precompilation errors.
Close the program by selecting Exit from the File menu. (You are prompted to save your project if it changed in any way.)
Suggestion:
If you want to keep an original file, as well as a version of the file with your changes, select the Save As command. The Save command overwrites the prior version. |
Double-click the yellow (or the red) checkmark to display the Precompilation Status list box, which lists warning messages or reasons why the precompilation failed:
Switch to your development environment, or your own editor, to fix the problems. After you correct the errors, precompile again.
If you perform the majority of your programming tasks from the command line, it is recommended that you continue to run Pro*C/C++ from the command line as well. Use the following syntax to precompile an application with Pro*C/C++:
C:\>PROC INAME=filename.PC
where, filename.pc is the name of the source file. The precompiler then generates a filename.c, which can be compiled by your C compiler.
If the source file is not within your current working directory, include the file's full path after the INAME argument.
Pro*C/C++ Standard Header Files are installed in the \PRO80\C\INCLUDE directory under your Oracle home directory.
Additional
Information:
For more information on each standard header file, see the Programmer's Guide to the Oracle Pro*C/C++ Precompiler. |
Consist of extended set of diagnostic tools for runtime errors and status changes. ORACA handles Oracle communications. Note, that using the ORACA adds to runtime overhead.
Consists of SQLLIB functions that enable OCI environment handle and OCI service context to be obtained in a Pro*C/C++ program.
Consists of ANSI prototypes for externalized functions that can be used in conjunction with OCI.
Consists of the host language data structure. Oracle updates the SQLCA after every executable SQL statement (values are undefined after a declarative statement). By checking Oracle return codes stored in the SQLCA, your program can determine the outcome of an SQL statement.
Provides platform-specific, ANSI prototypes for SQLLIB functions that are generated by Pro*C/C++. By default, Pro*C/C++ does not support full-function prototyping of SQL programming calls. If you need this feature, include SQLCPR.H before any EXEC SQL statements in your Oracle database application source file.
Consists of the host program data structure that holds descriptions of select-list items or input host variables. SQLDA files differ among host languages and operating systems.
Consists of K&R prototypes for externalized functions that can be used in conjunction with OCI.
If you are using embedded PL/SQL blocks, you must include the SQLCHECK parameter in the precompiling command, specifying the FULL option, as SQLCHECK=FULL. This parameter checks the syntax or semantics of embedded SQL statements and PL/SQL blocks.
Additional
Information:
For more information, see the Programmer's Guide to the Oracle Pro*C/C++ Precompiler. |
|
Copyright © 1997 Oracle Corporation. All Rights Reserved. |
|