Hello
I have problem linking f90 code with c/c++ code using ifort. The situation is like this:
The fortran code callmesh_tetgen_f.f90 call the function callmesh_tetgen_c defined in header callmesh_tetgen_c.h:
SUBROUTINE callmesh_tetgen_c(iflag,itask,ndim,npt,nnode,nelem,nnodb,neleb,nholes,cord,lnods,lnodb,cdholes,iostat)
!DEC$ ATTRIBUTES C :: callmesh_tetgen_c
....................
END SUBROUTINE callmesh_tetgen_c
The callmesh_tetgen_c.cpp implement the function callmesh_tetgen_c:
extern "C" void callmesh_tetgen_c(...)
{
...
tetrahedralize(...);
...
}
This function call "tetrahedralize" defined in tetgen library (in c++). When I link my program to callmesh_tetgen_c.cpp using
ifort -cxxlib -o mainpg mainpg.o callmesh_tetgen_c.cpp.o libtetgen.a
throw compilation error:
callmesh_tetgen_c.cpp:(.text+0x311): undefined reference to `tetrahedralize(char*, tetgenio*, tetgenio*, tetgenio*, tetgenio*)'
It seems that using ifort doesn't link c++ object to c++ static library correctly. How could I resolve this problem?
Giang Bui