- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi!
I have been desperately searching google and its groups in vain. Hope you can help. I need to call some ancient fortran objects from C++-main program using the latest intel compiler V8.1 on Linux 2.6.x.
Compilers are properly installed and working, i.e. LD_LIBRARY_PATH and PATH is set correctly.
Calling Fortan (example.f) from C (main.c) works fine using
> icc -c main
> ifort -o main main.o function.f -nofor_main
However, C++ seems to have some problems. Here are the codes:
----- FORTRAN: function.f -----
SUBROUTINE fortrantest()
IMPLICIT NONE
PRINT *, "Simple test o.k."
END
----- C++: main.C ----------
#include
using namespace std;
extern "C"
{
extern void fortrantest_();
}
int main()
{
cout "Testing call" endl;
fortrantest_();
}
----------------------
using
> icpc -c main.C
> ifort -c function.f -nofor_main
works without errors, but linking with
> ifort -o main function.o main.o -nofor_main main.o
produces lots of undefined refs. icpc produces different
and fewer error-messages
> icpc -o main function.o main.o
function.o(.text+0x36): In function `fortrantest_':
: undefined reference to `for_write_seq_lis'
Any suggestions welcome!
Thanx
ST
I have been desperately searching google and its groups in vain. Hope you can help. I need to call some ancient fortran objects from C++-main program using the latest intel compiler V8.1 on Linux 2.6.x.
Compilers are properly installed and working, i.e. LD_LIBRARY_PATH and PATH is set correctly.
Calling Fortan (example.f) from C (main.c) works fine using
> icc -c main
> ifort -o main main.o function.f -nofor_main
However, C++ seems to have some problems. Here are the codes:
----- FORTRAN: function.f -----
SUBROUTINE fortrantest()
IMPLICIT NONE
PRINT *, "Simple test o.k."
END
----- C++: main.C ----------
#include
using namespace std;
extern "C"
{
extern void fortrantest_();
}
int main()
{
cout "Testing call" endl;
fortrantest_();
}
----------------------
using
> icpc -c main.C
> ifort -c function.f -nofor_main
works without errors, but linking with
> ifort -o main function.o main.o -nofor_main main.o
produces lots of undefined refs. icpc produces different
and fewer error-messages
> icpc -o main function.o main.o
function.o(.text+0x36): In function `fortrantest_':
: undefined reference to `for_write_seq_lis'
Any suggestions welcome!
Thanx
ST
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
O.k., my problem has been solved... I needed to tell icpc the path to ifcore and explicitly link it.
Cheers
Cheers
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page