CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

C++ & F90 Compilation on SGIs

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 21, 2000, 14:53
Default C++ & F90 Compilation on SGIs
  #1
David Hunt
Guest
 
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, 15:01
Default Re: C++ & F90 Compilation on SGIs
  #2
Oliver Gloth
Guest
 
Posts: n/a
Check out the "Object-Oriented Numerics Page" oonumerics.org. 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, 04:43
Default Re: C++ & F90 Compilation on SGIs
  #3
Stefan Nilsson
Guest
 
Posts: n/a
Hi,

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, 04:55
Default Thanks: C++ & F90 Compilation sorted
  #4
David Hunt
Guest
 
Posts: n/a
Stefan,

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

Dave
  Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
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 18:19
Makefile for f90 under unix Jinwon Main CFD Forum 1 September 22, 2007 06:10
Compilation error with uparm.f Raghu Siemens 2 May 30, 2007 03:09
Compilation Error.... Arnab Siemens 4 September 12, 2004 16:54


All times are GMT -4. The time now is 21:52.