Hi All,

I try to mix some C and Fortran (I know not such a good idea).

Anyhow I create a project and then use cmake to manage the build. (see attach)
C is the main language, if I may say so, It links.

I get a linking error
Linking C executable bin/testme
/usr/bin/cmake -E cmake_link_script CMakeFiles/testme.dir/link.txt --verbose=1
/usr/bin/gcc    -fPIC CMakeFiles/testme.dir/source/main.c.o  -o bin/testme -
rdynamic lib/libhello.a
lib/libhello.a(libhello.f90.o): In function `hello':
libhello.f90:(.text+0x43): undefined reference to `_gfortran_st_write'
libhello.f90:(.text+0x59): undefined reference to 
`_gfortran_transfer_character'
libhello.f90:(.text+0x71): undefined reference to `_gfortran_transfer_integer'
libhello.f90:(.text+0x7d): undefined reference to `_gfortran_st_write_done'
collect2: ld returned 1 exit status
make[2]: *** [bin/testme] Error 1
make[2]: Leaving directory `/home/alin/playground/mixCFortran/build'
make[1]: *** [CMakeFiles/testme.dir/all] Error 2
make[1]: Leaving directory `/home/alin/playground/mixCFortran/build'
make: *** [all] Error 2


The problem is very easy solvable by just linking against the fortran runtime 
libs (/usr/lib64/libgfortran.so) in this case (gnu compilers).

My question is. Shouldn't cmake handle this internally, so the user does not 
bother about?

regards,

Alin

-- 
 ______________________________________________________________________
 "If the Universities will not study useless subjects, who will?"
                             G. F. FitzGerald, Nature, 45/46, 392 (1892)
 ______________________________________________________________________
 Mr  Alin M ELENA
 Irish Centre for High-End Computing -- www.ichec.ie
 The Design Tower, Trinity Technology & Enterprise Campus
 Grand Canal Quay,  Dublin 2, Ireland
 Tel:   +353 (0) 1 5241608 ext 29
 Fax: +353 (0) 1 7645845
 http://alin.elenaworld.net
 alin.el...@ichec.ie
 alinm.el...@gmail.com
 ______________________________________________________________________

Attachment: mixCFortran.tar.bz2
Description: application/bzip-compressed-tar

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to