Chapter Contents

Previous

Next
Using the SAS/C Cross-Platform Compiler and C++ Development System

Using the SAS/C and C++ Cross-Platform Compiler under the Microsoft Visual C++ IDE

If you prefer to use the Microsoft Developer Studio, you can use the SAS/C and C++ Cross-Platform Compiler within the Microsoft Visual C++ Integrated Development Environment. To ensure that the SAS/C and C++ Cross-Platform Compiler is invoked in the Microsoft Developer Studio, follow these steps:

  1. Select the Tools menu from the Microsoft Developer Studio toolbar.

  2. Select Compiler Options.

  3. Select SAS/C and C++ Cross-Platform Compiler.

  4. Select OK.

When you select the SAS/C and C++ Cross-Platform Compiler from the Microsoft Developer Studio Tools menu, it becomes the default compiler whenever you restart Microsoft Visual C++. The item for the SAS/C and C++ Cross-Platform Compiler on the Compiler Options menu is the default selection, but it does not reflect the current compiler selection set up in the Registry.

To compile and prelink source code using the SAS/C and C++ Cross-Platform Compiler, you first need to configure the compile and prelink options in the Win32 Release settings for your project. Although some menu differences exist between Version 4.2 and later versions of Microsoft Visual C++, these operations apply to Version 4.2 and later versions. The following examples are taken from Microsoft Visual C++ 5.0, but the SAS/C++ Cross-Platform Compiler is compatible with Version 4.2 and later of Microsoft Visual C++.


Configuring Compile and Prelink Options

The following example uses a project named ftoc . Use the following procedure to configure the compile and prelink options for the ftoc project in Microsoft Visual C++:

  1. Select the Build menu.

  2. Select Set Active Configuration.

  3. Select the ftoc-Win32 Release project configuration.

  4. Select the Project menu.

  5. Select the Settings option.

  6. Select the C/C++ tab.

  7. Remove all the Microsoft Visual C++ compiler options except for the following: /ML .

The SAS/C and C Cross-Platform Compiler ignores the /ML option. Also, the Microsoft Visual C++ compiler options in Recognized Microsoft Visual C++ Compiler Options are interpreted as valid SAS/C Cross-Platform Compiler options.

Recognized Microsoft Visual C++ Compiler Options
Microsoft Option Description
/Fdfilename Renames program database file
/nologo Suppresses display of sign-on banner
/Dname[=def] Defines constants and macros
/c Compiles without linking
/Zi Generates complete debugging information
/O Executes Global Optimizer
/O1 Executes Global Optimizer
/O2 Executes Global Optimizer
/Idirectory Searches a directory for include files

In the Project Options field, you can add any of the SAS/C and C++ Cross-Platform Compiler options that are listed in the compiler options list in the SAS/C Cross-Platform Compiler and C++ Development System: Usage and Reference. For example, to specify verbose commands, automatic instantiation of class templates, run-time type identification, and re-entrant code generation, add the -v , -Kautoinst , -Krtti , and -Krent options for sascc370 .

Delete all the project options under the Project Settings Link tab except for /incremental:no , /pdb:"/ftoc.pdb" , and /machine:IX86 . The sascc370 driver ignores these three options. Specify the name of the prelinked output file in the Output file name field. Add any sascc370 driver options for prelinking, such as -v , to the Project Options field. The Project Options field should appear as /incremental:no /pdb:"/ftoc.pdb" /machine:IX86 /out:"ftoc" -v .


Adding and Deleting Compiler and Project Options

You can use the Project Options window to add any SAS/C and C++ Cross-Platform Compiler options. Similarly, you can use the Project Settings Link tab to delete all the Project Options except /incremental:no/pdb:"/ftoc.pdb"/machine:IX86 . These options are enforced by the Microsoft Visual C++ IDE, but they are ignored by the SAS/C and C++ Cross-Platform Compiler.

If source-level settings are required for a project, you can use the following procedure to set options for each source file in the Settings For text box in the Project Settings dialog box:

  1. Select the C/C++ tab.

  2. Select Category.

  3. Select General from the drop-down menu and enter your preprocessor definitions.

  4. Select Category again.

  5. Select Preprocessor and enter any additional include directories.

  6. Select the Undefined symbols text box, and enter any sascc370 options for the compiler that are to be allocated to the selected source file.

    Note:    These driver options are not defined by the Microsoft Visual C++ IDE, and are applicable only to sascc370 . A /U will prefix any options entered in this area when you view it in the Source File Options text box. The sascc370 driver ignores the /U , and it passes any associated options to the appropriate phases of compilation.

    To compile and pre-link source code, select Build ftoc from the Build pull-down menu.  [cautionend]


Compiling and Prelinking Object Code

To compile and prelink the source code, select the Build ftoc item from the Build menu. The SAS/C and C++ Cross-Platform Compiler generates a compiled object file, ftoc.obj , and a prelinked output file, ftoc.exe . Any execution messages or error diagnostics are displayed in the Output view.


Chapter Contents

Previous

Next

Top of Page

Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.