Re: Problem to use NAG libraries in C++





On Jan 29, 6:23 am, "SimonG" <s...@xxxxxxxxxxxxxx> wrote:
There error you're reporting is a linker error not a compiler error.
It is caused by trying to link a program containing C++ and fortran
via the fortran compiler. If your main program is in C++ this is a bad
idea (for reasons I won't go into here) and should be avoided. Insead
link your main program with C++ and pass the nag library to it as well
as the required fortran libraries (I've no idea where they are on the
Sun):

CC -c usingnag.cpp -lnag -l<your fortran library> -lm

Your main program might need to call a fortran library initialization
routine - you'll need to consult Sun's documantation for that).

You're right that the OP should used CC to link. Sun's documentation
states that mixed C and Fortran programs should be linked using the
Fortran driver. A program that uses any C++ should be linked with
the C++ driver. The command line option -xlang eliminates the need
to know which libraries are needed.

Bob Corbett

.



Relevant Pages

  • Re: Whats in the Fortran libraries?
    ... Fortran libraries are a lot of things. ... Computer code is generally worth $0.01 per line, ... Engineering Calculations ...
    (comp.lang.fortran)
  • Re: internal write
    ... about 1985) the C and Fortran libraries separately buffered ... I believe that now most have the Fortran library call the ... say it's processor dependent whether or not Fortran and C ... interpretation are that the effects are effectively processor ...
    (comp.lang.fortran)
  • Windows Mixed Language mex S-function build
    ... On Windows Matlab I am using mex to link c-code source ... with pre-existing Fortran libraries to generate a Simulink ... fatal error due to an attempt from a Fortran subroutine to ...
    (comp.soft-sys.matlab)
  • Re: Get Key Function?
    ... it mentions reading single keystrokes. ... isn't a portable way to do this in Fortran, but he offers a C function ... in C libraries than Fortran libraries. ...
    (comp.lang.fortran)
  • Re: Surprise
    ... haven't seen any Fortran libraries that do that. ... You can call them with C interoperability from Fortran. ... languages), but much more written in Fortran. ...
    (comp.lang.fortran)