n*****w 发帖数: 14 | 1 Any system admin here? I have this question related to c++ programming on
unix to ask for help.
While I can compile and run C programs with no problem, it's not the case
for C++. For example, after I edited a simple "Hello World" program
named "hello.cc" and compiled it using "g++ hello.cc", I got error
message executing the resulting "a.out", like this:
ld.so.1: a.out: fatal: libstdc++.so.2.10.0: open failed: No such file or
directory
It looks like libstdc++.so.2.10.0 is not available. I checke | x*****g 发帖数: 6 | 2 which unix you have ? solaris ? HP ? Digital Alpha ?
for solaris, you need to install the libgcc packages/
get them from
http://www.sunfreeware.com/programlistsparc8.html#libgcc
【在 n*****w 的大作中提到】 : Any system admin here? I have this question related to c++ programming on : unix to ask for help. : While I can compile and run C programs with no problem, it's not the case : for C++. For example, after I edited a simple "Hello World" program : named "hello.cc" and compiled it using "g++ hello.cc", I got error : message executing the resulting "a.out", like this: : ld.so.1: a.out: fatal: libstdc++.so.2.10.0: open failed: No such file or : directory : It looks like libstdc++.so.2.10.0 is not available. I checke
| n*****w 发帖数: 14 | 3 solaris. But I can compile (gcc) and run c programs with no problem at all,
and I found libc.a and libc.so in /usr/lib/. Do u think it's missing c++
library? Is c++ library included in libgcc (as in your link)? Thanks.
【在 x*****g 的大作中提到】 : which unix you have ? solaris ? HP ? Digital Alpha ? : for solaris, you need to install the libgcc packages/ : get them from : http://www.sunfreeware.com/programlistsparc8.html#libgcc
| n*****w 发帖数: 14 | 4 actually on another unix system, there is no libstdc++.* while it's
fine to run c++ program. Why?
【在 x*****g 的大作中提到】 : which unix you have ? solaris ? HP ? Digital Alpha ? : for solaris, you need to install the libgcc packages/ : get them from : http://www.sunfreeware.com/programlistsparc8.html#libgcc
| o******d 发帖数: 1552 | 5 In Solaris, it is "libc.a" if it is static.
Any system admin here? I have this question related to c++ programming on
unix to ask for help.
While I can compile and run C programs with no problem, it's not the case
for C++. For example, after I edited a simple "Hello World" program
named "hello.cc" and compiled it using "g++ hello.cc", I got error
message executing the resulting "a.out", like this:
ld.so.1: a.out: fatal: libstdc++.so.2.10.0: open failed: No such file or
directory
It looks like l
【在 n*****w 的大作中提到】 : Any system admin here? I have this question related to c++ programming on : unix to ask for help. : While I can compile and run C programs with no problem, it's not the case : for C++. For example, after I edited a simple "Hello World" program : named "hello.cc" and compiled it using "g++ hello.cc", I got error : message executing the resulting "a.out", like this: : ld.so.1: a.out: fatal: libstdc++.so.2.10.0: open failed: No such file or : directory : It looks like libstdc++.so.2.10.0 is not available. I checke
| c*****t 发帖数: 1879 | 6 There are several places to check...
If the administrator built the gcc/g++ by himself, he can put libstdc++.a
in just about any place since the path info is given at the compile time.
Usually, what you need to do is to search
/usr/lib/
/usr/local
/usr/local/lib
and look for directories w/ gcc/g++ prefixes. Some times, checking the
location of g++/gcc (since they can be a soft link indicate where the
stuff is). On solaris, also check /opt.
Also, do the man page on g++ a
【在 n*****w 的大作中提到】 : Any system admin here? I have this question related to c++ programming on : unix to ask for help. : While I can compile and run C programs with no problem, it's not the case : for C++. For example, after I edited a simple "Hello World" program : named "hello.cc" and compiled it using "g++ hello.cc", I got error : message executing the resulting "a.out", like this: : ld.so.1: a.out: fatal: libstdc++.so.2.10.0: open failed: No such file or : directory : It looks like libstdc++.so.2.10.0 is not available. I checke
| w**n 发帖数: 88 | 7 Probably that is the case: Gnu complier does not come with solaris, the
lib location is totaly decided by the admin who installed it.by default,
it should be in /usr/local/lib.
So, find out the file, add the cresponding path to your LD_LIBRARY_PATH
varible.
【在 n*****w 的大作中提到】 : Any system admin here? I have this question related to c++ programming on : unix to ask for help. : While I can compile and run C programs with no problem, it's not the case : for C++. For example, after I edited a simple "Hello World" program : named "hello.cc" and compiled it using "g++ hello.cc", I got error : message executing the resulting "a.out", like this: : ld.so.1: a.out: fatal: libstdc++.so.2.10.0: open failed: No such file or : directory : It looks like libstdc++.so.2.10.0 is not available. I checke
| n*****w 发帖数: 14 | 8 u r right. I found libstdc++.a.2.10.0 and libstdc++.so.2.10.0 at
/usr/local/lib/ (but libc.a is at /usr/lib/). Now I wonder how to add
to LD_LIBRARY_PATH. I don't have such an environmental variable.
I've tried the following, but all compiled fine and got error when executing:
1. g++ hello.cc (ok, => a.out)
a.out (error, as in original post)
2. g++ -c hello.cc
g++ -o hello -lg++ hello.o (error, no library g++ found)
3. g++ -c hello.cc
g++ -o hello -L/usr/local/lib/ hello.o
a.out (same error as i
【在 w**n 的大作中提到】 : Probably that is the case: Gnu complier does not come with solaris, the : lib location is totaly decided by the admin who installed it.by default, : it should be in /usr/local/lib. : So, find out the file, add the cresponding path to your LD_LIBRARY_PATH : varible.
| m*****e 发帖数: 4193 | 9
Do you know what you are doing? Hint: -o hello
【在 n*****w 的大作中提到】 : u r right. I found libstdc++.a.2.10.0 and libstdc++.so.2.10.0 at : /usr/local/lib/ (but libc.a is at /usr/lib/). Now I wonder how to add : to LD_LIBRARY_PATH. I don't have such an environmental variable. : I've tried the following, but all compiled fine and got error when executing: : 1. g++ hello.cc (ok, => a.out) : a.out (error, as in original post) : 2. g++ -c hello.cc : g++ -o hello -lg++ hello.o (error, no library g++ found) : 3. g++ -c hello.cc : g++ -o hello -L/usr/local/lib/ hello.o
| w**n 发帖数: 88 | 10 csh/tcsh: setenv LD_LIBARY_PATH $LD_LIBARY_PATH:/usr/local/lib
bourn:
LD_LIBARY_PATH=$LD_LIBARY_PATH:/usr/local/lib
export LD_LIBARY_PATH
在 netview (Net Viewer) 的大作中提到: 】 | n*****w 发帖数: 14 | 11
what's wrong here? linking ah. If u mean i should link with another object
or library, that's what i tried in #4.
【在 m*****e 的大作中提到】 : : Do you know what you are doing? Hint: -o hello
| n*****w 发帖数: 14 | 12 Thanks. What about bash? Currently $LD_LIBRARY_PATH is not set.
【在 w**n 的大作中提到】 : csh/tcsh: setenv LD_LIBARY_PATH $LD_LIBARY_PATH:/usr/local/lib : bourn: : LD_LIBARY_PATH=$LD_LIBARY_PATH:/usr/local/lib : export LD_LIBARY_PATH : 在 netview (Net Viewer) 的大作中提到: 】
| m*****e 发帖数: 4193 | 13
You output hello, while you run a.out
【在 n*****w 的大作中提到】 : Thanks. What about bash? Currently $LD_LIBRARY_PATH is not set.
| n*****w 发帖数: 14 | 14 oh, of course i changed the name of the executable.
【在 m*****e 的大作中提到】 : : You output hello, while you run a.out
|
|