AIX5.3上用g++编译简单的C++代码时链接错误,请指教
首页 »
论坛 » C/C++ » |
|
|

- 帖子
- 191
- 主题
- 0
- 精华
- 0
- 可用积分
- 261
- 专家积分
- 0
- 在线时间
- 105 小时
- 注册时间
- 2008-04-23
- 最后登录
- 2010-01-02
状态:...当前离线...
[博客]
[短信]
|
第一步,我在AIX5.3上安装了以下5个包
gcc-4.0.0-1.aix5.3.ppc.rpm
gcc-cplusplus-4.0.0-1.aix5.3.ppc.rpm
libgcc-4.0.0-1.aix5.3.ppc.rpm
libstdcplusplus-4.0.0-1.aix5.3.ppc.rpm
libstdcplusplus-devel-4.0.0-1.aix5.3.ppc.rpm
第二步,编写简单的C++代码hello.cpp
- #include<iostream>
- using namespace std;
- int mian(int argc,char **argv)
- {
- cout<<"hello word!"<<endl;
- return 0;
- }
复制代码
第三步,编译g++ -c hello.cpp
成功生成hello.o
第四步,链接g++ -o hello hello.o
失败,报错如下:
- ld: 0711-317 ERROR: Undefined symbol: vtable for __cxxabiv1::__class_type_info
- ld: 0711-317 ERROR: Undefined symbol: .std::basic_istream<char, std::char_traits<char> >::read(char*, long)
- ld: 0711-317 ERROR: Undefined symbol: .std::basic_ostream<char, std::char_traits<char> >::write(char const*, long)
- ld: 0711-317 ERROR: Undefined symbol: .std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)
- ld: 0711-317 ERROR: Undefined symbol: .std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&)
- collect2: ld returned 8 exit status
- make: The error code from the last command is 1.
复制代码
第五步,我在.profile文件中添加了环境变量LD_LIBRARY_PAT=/opt/frameware/aix-5.3.0/4.0.0/gcc/lib
然后再编译,依然报上面那个错
请教高手这是怎么回事?我哪里还配置的不对吗?
[ 本帖最后由 light511 于 2009-11-24 00:32 编辑 ] |
|
|
|
|
|

- 帖子
- 90
- 主题
- 0
- 精华
- 0
- 可用积分
- 145
- 专家积分
- 19
- 在线时间
- 316 小时
- 注册时间
- 2005-06-13
- 最后登录
- 2010-02-04
状态:...当前离线...
[博客]
[短信]
|
ld程序或GCC版本得问题?
我用得版本是 4.2.0.3***得RPM
AIX版本: 5300-06, 5300-07 |
|
|
__________________________________ Code Myself Enjoy Myself
|
|
|
|
|
|
|
|
GMT+8, 2010-02-09 08:31, Processed in 0.017424 second(s), 7 queries, Gzip enabled.
|