Re: Linking mixed language objects under windows

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Okay .. found the problem myself: mingw wants the -lgfortran to appear after 
the file in the argument so this

gcc -o hw hw.o -lgfortran

works.


Hi,

I have a large project involving c++ and FORTRAN90 components. Everything 
works under Linux, but under Windows I can't seem to convince gcc or g++ to 
link objects created by gfortran. In short, what I need to do is create all my 
objects: the ones written in c++ with g++ and the ones written in fortran with 
gfortran; and then link them, preferably with g++. The linker step fails 
complaining about a bunch of undefined references, e.g.

undefined reference to '_gfortran_st_write'

But as far as I can see all of those are present in libgfortran.a, which is 
found and used by the linker.

I could not even get a minimal example to work where I have a FORTRAN program 
like this

WRITE(*,*) "Hello World!"

and then compile

gfortran -c -o hw.o hw.f90

and link

gcc -o hw -lgfortran hw.o

I am using the binaries available through the gfortran wiki (gcc 4.5). I get 
the same problem when I try to cross compile from fedora 11.

Andreas

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux