- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I have a C++ code and Fortran code. The fortran code is for multiprocessor, whereas the C++, which calls the fortran, is not for multiprocessor written, but calling an MPI it needs multiprocessor as well.
I am using intel 11.1 and the commands are:
mpif77 -c example.f
mpicc -o example ecample.cc example.o -L/usr/local/commercial/intel/fce/11.1/lib/intel64/ -lifcore
it gives me this error:
/tmp/iccNEJDne.o(.text+0x8b): In function `main':
: undefined reference to `LBM_'
The c++ code is:
#include
#include
extern "C"
{
void LBM_(int*,double*,int*,double*,double*);
}
int main()
{
int r_small=7,s=26;
double Reynolds=100,vor,pr_diff;
cout << "The Reynolds is" << Reynolds<< endl;
LBM_(&r_small,&Reynolds,&s,&pr_diff,&vor);
cout << "The vorticity is" << vor<< endl;
cout << "The pressure difference is" << pr_diff<< endl;
cout << "Made pijo" << endl;
return 0;
}
whereas the starting of the fortran is:
subroutine LBM(r_small,Reynolds,s,pr_diff,vor)
implicit none
include 'mpif.h'
.........................
return
end
Both the code alone compile with no problem, it's when I compile them together that they make problem.
I tried to compile a non MPI C++ and fortran code and it works
Have you got any clue, please?
Thank you
Kind Regards
Antonio
I have a C++ code and Fortran code. The fortran code is for multiprocessor, whereas the C++, which calls the fortran, is not for multiprocessor written, but calling an MPI it needs multiprocessor as well.
I am using intel 11.1 and the commands are:
mpif77 -c example.f
mpicc -o example ecample.cc example.o -L/usr/local/commercial/intel/fce/11.1/lib/intel64/ -lifcore
it gives me this error:
/tmp/iccNEJDne.o(.text+0x8b): In function `main':
: undefined reference to `LBM_'
The c++ code is:
#include
#include
extern "C"
{
void LBM_(int*,double*,int*,double*,double*);
}
int main()
{
int r_small=7,s=26;
double Reynolds=100,vor,pr_diff;
cout << "The Reynolds is" << Reynolds<< endl;
LBM_(&r_small,&Reynolds,&s,&pr_diff,&vor);
cout << "The vorticity is" << vor<< endl;
cout << "The pressure difference is" << pr_diff<< endl;
cout << "Made pijo" << endl;
return 0;
}
whereas the starting of the fortran is:
subroutine LBM(r_small,Reynolds,s,pr_diff,vor)
implicit none
include 'mpif.h'
.........................
return
end
Both the code alone compile with no problem, it's when I compile them together that they make problem.
I tried to compile a non MPI C++ and fortran code and it works
Have you got any clue, please?
Thank you
Kind Regards
Antonio
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Solved, the subroutine in C++ must be in lowercase

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