Linux, libstdc++ and .cpp file extension
Michael Mueller
mmueller@signalnetware.com
Fri Sep 21 13:40:00 GMT 2001
John,
Thank you for the help and explanations. Below I report the results
of each suggestion.
My Linux system seems to have a preference for those libraries being
in /usr/lib. So until I can figure out why, I'll give it what it
wants. It leaves me with a nagging feeling that I am not in control
of the machine, however.
Mike
----- Original Message -----
From: "John Love-Jensen" <eljay@adobe.com>
To: "Michael Mueller" <mmueller@signalnetware.com>
Sent: Friday, September 21, 2001 1:49 PM
Subject: Re: Linux, libstdc++ and .cpp file extension
: Hi Mike,
:
: First, you should use "g++ -o test test.cc".
Done. libstdc++ error still reported.
:
: Second, you should use "#include <iostream>", since <iostream.h>
is
: deprecated.
:
Done. libstdc++ error still reported.
: Third, you should do a "using namespace std;" after your header
files.
:
Done. libstdc++ error still reported.
: Fourth, you may need to set your environment variable
LD_LIBRARY_PATH to
: include the directory that has the libstdc++.so.3 file.
Done. libstdc++ error still reported. I am disappointed that this
did not work - it seems as though it should. I used the following:
LD_LIBRARY_PATH=/usr/local/lib
and
LD_LIBRARY_PATH=/usr/local/lib/
Or, alternatively,
: you can put a softlink to it in your current directory "ln -s
: /usr/local/gcc/lib/libstdc++.so.3" (wherever it resides on your
system).
Not done.
: Or, another alternative, it to copy or softlink the libstdc++.so.3
to the
: /lib directory.
:
Done. libgcc_s.so.1 error reported. Copied file to /usr/lib.
Program ran with no errors.
: My blind guesses...
:
: Scenario A fails because the loader doesn't know where the
libstdc++.so.3
: file lives. You can see which shared objects (.so) are relied
upon by the
: "ldd a.out" command. You might want to check "type -a gcc" versus
"type -a
: g++" from your bash shell command line, to double check where they
are
: located. And/or it also may be failing because gcc doesn't
presume
: the -lstdc++ is necessary.
:
Tried adding "-lstdc++ to compile prior to copying library files to
/usr/lib. No effect.
: Scenario B succeeds because the archive library (.a) was linked in
directly.
:
: Scenario C succeeds because gcc recognizes the .cpp extension, and
launches
: g++ to perform the compile.
I reported a bogus result as I could not reproduce this scenario a
short while later. I was going to send a follow up email concerning
this matter just as your reply came in.
:
: Sincerely,
: --Eljay
:
More information about the Gcc-help
mailing list