Linking mixed FORTRAN and C++ in the Visual studio 2008 environment

Linking mixed FORTRAN and C++ in the Visual studio 2008 environment

I am calling a C++ function from FORTAN using ISO_C_Binding
module. I can compile and link the Fortran and C++ files using MINGW g++
and gfortran command line option using the command sequence

gfortran -c main.f90

g++ -c print_hi.cpp

for compiling and for linking I can use the gfortran option and including the C++ standard libraries as

gfortran main.o print_hi.o -o main -lstdc++

which work absolutely fine.
Now my questions is how can I do the same in the visual studio
environment. In case of simple C we will just include the print_hi.o
file in the additional dependencies in the linker but if I only include
this C++ file (print_hi.o), it gives errors like

Error LNK2010: unresolved external symbol _ZSt4cout referenced in function _print_hi
etc etc

So I guess I need to give the path to the C++ libraries in my FORTRAN
project as we are doing in the command line MINGW case but I dont know
how to do this.

PS: I am using windows Vista, with intell visual fortran compiler
professional edition 11.1 in Visual studio 2008 and C++ in Visual studio
2010 in the same computer.

1 post / 0 new
For more complete information about compiler optimizations, see our Optimization Notice.