This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Linux, libstdc++ and .cpp file extension


I had a problem and I solved it (with the help of the gcc-help
archives - thank you all).

Can anyone tell me why the following things occurred in the
scenarios described below?  A pointer the the appropriate RTFM is
welcomed.

I am using i586 architecture with RedHat 6.0 with Linux kernel
2.2.14.  I have compiled and installed gcc 3.0 with no apparent
errors.  The libstdc++ version 3 is located in /usr/local/lib
(presumably installed when I compiled and installed gcc 3.0).  The
directory /usr/lib contains a variety of libstdc++ stuff at the 2.7,
2.8, and 2.9 levels (presumably from the RH 6.0 installation).

My c++ program is from section 1.3.1 of Stroustrup's C++, 2nd Ed.:

#include (iostream.h>

int main()
{
    cout << "Hello, World!\n";
}

Scenario A:

I compile as follows:

gcc -o test test.cc

I execute as follows:

./test

I get the following error:

./test: error in loading shared libraries: libstdc++.so.3: cannot
open shared object file:
No such file or directory

Scenario B:

I add the "-static" flag to the compile described in Scenario A
above and I get "Hello, World!" when I execute the program.

Scenario C:

I change the name of the source file to test.cpp and compile as in
Scenario A above and I get "Hello, World!" when I execute the
program.

Thank you in advance.
Mike


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]