1 Oct 2004 11:37
Re: fortran link failures
Hello! On my system, after default installation of MinGW-3.1.0-1.exe, AND adjusting the PATH environment variable, as specified in the documentation, it works out of the box. Between other things the installation program not setting the PATH environment variable allows you to use different compilers (including different versions of MinGW). Following is a log of my session: Observe that when you mix C and Fortran functions/subroutines, and link with gcc, you must explicitly add to the link the g2c library and this behaviour is documented. Also note that when you call C functions/subroutines from Fortran, g77 expects their names end with '_' (see the file "gccp2.c" below) <session.log> D:\g77test>path=%path%;d:\MinGW\bin D:\g77test>mingw32-make g77 -s -Wall -W -o p1.exe p1.f g77 -s -Wall -W -c g77p2.f -o g77p2.o gcc -s -Wall -W p2linkedwithgcc.c g77p2.o -lg2c -o p2linkedwithgcc.exe gcc -s -Wall -W -c gccp2.c -o gccp2.o g77 -s -Wall -W p2linkedwithg77.f gccp2.o -o p2linkedwithg77.exe D:\g77test>p1 hello g77 D:\g77test>p2linkedwithgcc(Continue reading)
). But I assume you have some other problem, too, that you
wanted to ask about?
> class Second
> {
>
> public:
> void myfun(First &obj)
>
> [...]
>
> Second Obj2;
> Obj2.myfun(First());
You don't mention it, but you are probably gettting an error here.
Temporary objects are automatically considered const in this situation
in standard C++. So your code is passing a const object to a method
that expects a non-const reference.
You'll have to port the code to standard C++ to make it work with a
standard C++ compiler. Consider compile-time errors as getting help
in that project.
In this case either change myfun() to take a const reference, or use
RSS Feed