Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7944 Discussions

C++ - Fortran Intel on MPI compiling.

mortain
Beginner
268 Views
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
0 Kudos
1 Reply
mortain
Beginner
268 Views
Solved, the subroutine in C++ must be in lowercase
0 Kudos
Reply