avatar
n*w
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
avatar
x*g
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

avatar
n*w
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

avatar
n*w
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

avatar
o*d
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

avatar
c*t
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

avatar
w*n
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

avatar
n*w
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.

avatar
m*e
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

avatar
w*n
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) 的大作中提到: 】
avatar
n*w
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

avatar
n*w
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) 的大作中提到: 】

avatar
m*e
13

You output hello, while you run a.out

【在 n*****w 的大作中提到】
: Thanks. What about bash? Currently $LD_LIBRARY_PATH is not set.
avatar
n*w
14
oh, of course i changed the name of the executable.

【在 m*****e 的大作中提到】
:
: You output hello, while you run a.out

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。