g77 problem with -lstdc++
Jakub Jelinek
jakub at redhat.com
Mon Apr 28 07:54:10 UTC 2008
On Sun, Apr 27, 2008 at 07:21:43PM +0100, Paul Smith wrote:
> I am experiencing the following problem with g77
>
> $ g77 -O4 -lstdc++ cwrapper.o toyprob.o algencanma.o algencan.o -o algencanma
> /usr/bin/ld: cannot find -lstdc++
> collect2: ld returned 1 exit status
> $
>
> Any ideas?
I've just skimmed the thread, so sorry if this has been already answered.
First of all, have you tried compiling/linking using gfortran instead?
It supports not just Fortran95 and later, but also Fortran77. g77 is just a
Fortran77 compatibility compiler, in case you have code that uses the very
few g77 intrinsics that aren't supported by gfortran yet (this got even
better again in GCC 4.3).
Second, I saw the you have *.f and *.c sources, are you sure the latter
are C++ and not plain C (then you should just compile them using a C
compiler and don't need C++ compiler)?
If the answer for both of the above is that you really have to use g77 and
the sources are in C++, then make sure you have also compat-gcc-34-c++
package installed and compile the C++ sources using g++34, F77 sources
using g77 as you did and finally just link with g77.
If compat-gcc-34-c++ is installed, then g77 will be able to find the GCC 3.4
compatibility libstdc++. Also, you should learn to put -lstdc++ and other
-l* options last on the command line, not first - while the above works for
shared libstdc++, it wouldn't work for static link.
Jakub
More information about the fedora-list
mailing list