|
Last update: Sat Nov 17 16:23:13 2001
Comments, and reports of errata or bugs, are welcome via e-mail to the author, Nelson H. F. Beebe <beebe@math.utah.edu>. In your report, please supply the full document URL, and the title and Last update time stamp recorded near the top of the document.
In the Mark 18 release of the NAG C libraries, there are regrettable inconsistencies in internal #include statements which, on most machines, make it necessary to supply the compiler with two different locations of header files. On all local systems and compilers, these take the form -I/usr/local/include and -I/usr/local/include/Nag.
On each architecture, the second of these directories is a symbolic link to the appropriate directory in the installation tree, /usr/local/sys/nag/nag5, thereby masking the system-dependent directory name with a uniform name.
Similarly, the NAG C library is always available as files /usr/local/lib/libnagc.{a,so,sl}; these are symbolic links into the NAG installation tree. This makes it possible to refer uniformly to the library with compiler switches -L/usr/local/lib -lnagc.
On some architectures, there may be additional versions of the NAG libraries that have been compiled for specific CPU architectures or memory models, and depending on your processor, they may offer higher performance. Of necessity, the default installations include only the libraries that match the least-common denominator of architectures and memory models. If this applies to you, then you need to read the NAG installation notes; look for the topics beginning C Header Files for Marks 15 to 18 and NAG C Library in that long list.
The little test program, cnagtest.c, used below is available for your inspection. Each system section below contains a pointer to a large collection of more than 300 NAG-supplied sample files.
Some C and C++ compilers automatically search the /usr/local/include directory for header files, and the /usr/local/lib directory for load libraries, and thus do not require additional -Idir and -Ldir switches. The examples below show the minimal command line required in each case.
c89 -I/usr/local/include -I/usr/local/include/Nag \ -o cnagtest cnagtest.c -lnagc -lm cc -I/usr/local/include -I/usr/local/include/Nag \ -o cnagtest cnagtest.c -lnagc -lm CC -I/usr/local/include -I/usr/local/include/Nag \ -o cnagtest cnagtest.c -lnagc -lm cxx -x cxx -I/usr/local/include -I/usr/local/include/Nag \ -o cnagtest cnagtest.c -lnagc -lm g++ -I/usr/local/include -I/usr/local/include/Nag \ -o cnagtest cnagtest.c -lnagc -lm gcc -I/usr/local/include -I/usr/local/include/Nag \ -o cnagtest cnagtest.c -lnagc -lm lcc -Ualpha -I/usr/local/include -I/usr/local/include/Nag \ -o cnagtest cnagtest.c -lnagc -lm
The reason for the -Ualpha switch for lcc is that the compiler otherwise defines that name as an architecture flag, and that then incorrectly redefines a variable in the header file <Nag/nag_types.h>.
Further examples are available.
gcc -I/usr/local/include/Nag \ -o cnagtest cnagtest.c -lnagc -lm c89 -I/usr/local/include -I/usr/local/include/Nag \ -o cnagtest cnagtest.c -L/usr/local/lib -lnagc -lm g++ -I/usr/local/include/Nag \ -o cnagtest cnagtest.c -L/usr/local/lib -lnagc -lm CC -I/usr/local/include -I/usr/local/include/Nag \ -o cnagtest cnagtest.c -L/usr/local/lib -lnagc -lm
Further examples are available.
g++ -o cnagtest cnagtest.c -lnagc -lm gcc -o cnagtest cnagtest.c -lnagc -lm lcc -I/usr/local/include -o cnagtest cnagtest.c -lnagc -lm pgcc -o cnagtest cnagtest.c -lnagc -lm pgCC -o cnagtest cnagtest.c -lnagc -lm
Further examples are available.
cc -I/usr/local/include -I/usr/local/include/Nag \ -o cnagtest cnagtest.c -lnagc -lm CC -I/usr/local/include -I/usr/local/include/Nag \ -o cnagtest cnagtest.c -lnagc -lm g++ -I/usr/local/include -I/usr/local/include/Nag \ -o cnagtest cnagtest.c -lnagc -lm gcc -I/usr/local/include -I/usr/local/include/Nag \ -o cnagtest cnagtest.c -lnagc -lm lcc -I/usr/local/include -I/usr/local/include/Nag \ -o cnagtest cnagtest.c -lnagc -lm
Further examples are available.
c89 -I/usr/local/include -I/usr/local/include/Nag \ -o cnagtest cnagtest.c -lnagc -lm cc -I/usr/local/include -I/usr/local/include/Nag \ -o cnagtest cnagtest.c -lnagc -lm CC -I/usr/local/include -I/usr/local/include/Nag \ -o cnagtest cnagtest.c -lnagc -lm g++ -I/usr/local/include -I/usr/local/include/Nag \ -o cnagtest cnagtest.c -lnagc -lm gcc -I/usr/local/include -I/usr/local/include/Nag \ -o cnagtest cnagtest.c -lnagc -lm
lcc does not work with the NAG library: it produces -o32 memory-model object files, and there are none in the NAG C libraries.
Further examples are available.
c89 -I/usr/local/include \ -o cnagtest cnagtest.c -lnagc -lm CC -I/usr/local/include \ -o cnagtest cnagtest.c -lnagc -lm cc -I/usr/local/include \ -o cnagtest cnagtest.c -lnagc -lm g++ -I/usr/local/include \ -o cnagtest cnagtest.c -lnagc -lm gcc -I/usr/local/include \ -o cnagtest cnagtest.c -lnagc -lm lcc -I/usr/local/include \ -o cnagtest cnagtest.c -lnagc -lm
Further examples are available.