CFD Online Logo CFD Online URL
Home > Forums > Main CFD Forum

C++ & F90 Compilation on SGIs

Register Blogs Members List Search Today's Posts Mark Forums Read

LinkBack Thread Tools Display Modes
Old   June 21, 2000, 13:53
Default C++ & F90 Compilation on SGIs
David Hunt
Posts: n/a
Dear All,

this is not strictly a CFD query other than its target application. I'm trying to call an f90 sub-program from a C++ routine on an SGI. I suspect this is not an uncommon thing for CFD folk to do. I've read lots of manuals and still can't get it to work. I've put below example soucre code and command line stuff. If you can see where I'm going wrong, please let me know.

Many thanks Dave Hunt.

ccode.cpp: ========== #include<iostream> using namespace std; extern "C" void subr_(int*); main() { int nlen=3;

cout << "Hello World" << std::endl; subr_(&nlen); }

csubr.f90: ========== subroutine subr(nlen) integer :: nlen write(6,*) nlen end subroutine subr

command line: ============= (note, I'm using the SG CC and f90 compilers)

f90 -c csubr.f90 CC -LANG:std -c ccode.cpp CC -LANG:std ccode.o csubr.o

the last step gives me the following ERROR: ld32: ERROR 33 : Unresolved text symbol "_FWF" -- 1st referenced by csubr.o.

Use linker option -v to see when and which objects, archives and dsos are loaded. ld32: INFO 152: Output file removed because of error.

  Reply With Quote

Old   June 21, 2000, 14:01
Default Re: C++ & F90 Compilation on SGIs
Oliver Gloth
Posts: n/a
Check out the "Object-Oriented Numerics Page" There is a number of good links, including tools for language interoperability. A tool for C++/F77 exists and is called CPPF77. I don't know how useful it is for FORTRAN-90, though.
  Reply With Quote

Old   June 22, 2000, 03:43
Default Re: C++ & F90 Compilation on SGIs
Stefan Nilsson
Posts: n/a

I think the problem is that since you're using CC to link your application the correct fortran90 libraries are not included, and therefore the _FWF (whatever that is) cannot be found. You'll have to explicitly include the correct libraries when linking.

If you compile some simple f90-program (hello world) using the -v flag, you will se all libraries included when linking a f90 program, then just add these when linking the C++/f90 program.

Best wishes Stefan
  Reply With Quote

Old   June 22, 2000, 03:55
Default Thanks: C++ & F90 Compilation sorted
David Hunt
Posts: n/a

thanks, that was sound advice. I needed a -lfortran flag to link one of the f90 libraries.

  Reply With Quote


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
errors during compilation and installation of OpenFOAM-1.7.x on Ubuntu 10.04 ftec OpenFOAM Installation 7 February 23, 2011 07:07
Compilation Order and Single Precision Issues gocarts OpenFOAM Bugs 1 October 14, 2009 17:19
Makefile for f90 under unix Jinwon Main CFD Forum 1 September 22, 2007 05:10
Compilation error with uparm.f Raghu CD-adapco 2 May 30, 2007 02:09
Compilation Error.... Arnab CD-adapco 4 September 12, 2004 15:54

All times are GMT -4. The time now is 03:39.