Chapter Contents

Previous

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

Using SAS/C C and C++ under the Microsoft Visual C++ IDE

If you prefer to use the Microsoft Developer Studio, you can use SAS/C C and C++ within the Microsoft Visual C++ Integrated Development Environment. To ensure the SAS/C and C++ compiler is invoked in the Microsoft Developer Studio,

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

  2. Select Compiler Options.

  3. Select Cross-Platform SAS.

  4. Select OK.

When you select the SAS/C and C++ compiler from the Microsoft Developer Studio Tools menu, it becomes the default compiler whenever you restart Microsoft Visual C++. The selection button for the SAS/C and C++ compiler on the Compiler Options menu will not be highlighted, but the SAS/C and C++ compiler is the default compiler. If you later change the compiler selection from the SAS/C and C++ compiler to the Microsoft compiler, the Microsoft compiler becomes the default compiler.

To compile and prelink source code using the SAS/C and C++ 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 Microsoft Visual C++ Version 4.2 and Version 5.0, these operations apply to both versions. The following examples are taken from Microsoft Visual C++ 5.0, but the SAS/C C and C++ compiler is compatible with Versions 4.2 and 5.0 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 /FO"Release/" .

The SAS/C C and C++ compiler ignores the /ML and /FO"Release/" options. 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
/Uname Eliminates initial name definition
/Idirectory Searches a directory for include files

In the Project Options field, you can add any of the SAS/C C and C++ compiler options that are listed in Compiling C and C++ Programs. For example, to specify verbose commands, automatic instantiation of class templates, run-time type identification, and reentrant 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:"Release/ftoc.pdb" , and /machine:IX86 . The sascc370 driver ignores these three options. Specify the names of the input object modules in the Object/library modules field. Specify the name of the prelinked output file in the Output file name field. In this example, although the input object filename, ftoc.o , is located in directory D:\Program Files\DevStudio\MyProjects\temperature , the Object/library modules field does not contain the fully qualified object file pathname. Add any sascc370 driver options for prelinking, such as -v , to the Project Options field. The Project Options field should appear as ftoc.o /incremental:no /pdb:"Release/ftoc.pdb" /machine:IX86 /out:"ftoc" -v .


Compiling and Prelinking Object Code

To compile and prelink the source code, select the Build ftoc item from the Build menu. SAS/C C and C++ generate a compiled object file, ftoc.o , and a prelinked output file, ftoc . Any execution messages or error diagnostics are displayed in the Output view. For this example, when building ftoc.cxx , the output window should contain something like the output in Example output window contents:

Example output window contents

- - - - - - - - - - Configuration: ftoc - Win32 Release - - - - - - - - - -

Compiling...
SAS/C Compiler Driver V6.50.01
Copyright (C) 1998 SAS Institute Inc.
set INCLUDE370='d:\Program Files\SASC\Include'
"d:\Program Files\SASC\host\wnt\bin\cxx" -Adigraph1 -Adigraph2
-DCROSS370=l -XA -Hu '-r' '-Arrti' '-MC:\TEMP\sascca00319.1.ai'
'mftoc' "D:\Program Files\Dev\Studio\MyProjects\temperature\ftoc.cxx"
"C:\TEMP\sascca00319.1.c"
sascc370: Invalid '/FoRelease' ignored
SAS/C C++ 6.50.01 (Mar 2 1998)
Copyright (C) 1998 SAS Institute Inc.
"d:\Program Files\SASC\host\wnt\bin\lc1" -dCROSS370=1 -cd -hu -n! '-r'
-cxx -d__CXX_PRIMARY__=1 -q011=1 '-sftoc' -xc
"-oC:\TEMP\sascca00344.1.q" "C:\TEMP\sascca00319.1.c"
SAS/C Release 6.50.01 (Target 370 Cross Compiler)
Copyright (c) 1998 by SAS Institute Inc.  All Rights Reserved.
*** No errors; No warnings; No user suppressed warnings
"d:\Program Files\SASC\host\wnt\bin\lc2" "-oC:\TEMP\sascca00319.1.o"
"C:\TEMP\sascca00319.1.q"
SAS/C Compiler (Phase 2) Release 6.50.01
Copyright (c) 1998 by SAS Institute Inc.  All Rights Reserved.
"d:\Program Files\SASC\host\wnt\bin\sheller" -c -o ftoc.o
@C:\TEMP\sascca00319.1.shell
You have selected the SAS C/C++ Cross Platform Compiler
Linking...
SAS/C Compiler Driver 6.50.01
Copyright (c) 1998 SAS Institute Inc.
set INCLUDE370='d:\Program Files\SASC\Include'
"d:\Program Files\SASC\host\wnt\bin\cool" -o "ftoc"
-L"d:\Program Files\SASC" ftoc.o "d:\Program Files\SASC"\lib\libcxx.a
"d:\Program Files\SASC"\lib\mvs\libc.a
SAS/C (R) C Object code Pre-Linker Release 6.50.01
Copyright (c) 1998 by SAS Institute Inc.  All Rights Reserved.
cool: Note 1010: Pre-Linking completed with return code = 0
You have selected the SAS C/C++ Cross Platform Linker

ftoc - 0 error(s) 0 warning(s)


Chapter Contents

Previous

Next

Top of Page

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