- 论坛徽章:
- 0
|
第一次在unix下写C++程序:
#include<iostream>
using namespace std;
int main()
{
cout<<"HelloWorld"<<endl;
return(0);
}
就是上面的最简单的HelloWorld程序,用cc -c hello.cpp没有错误,但cc -o hello hello.cpp就报错了
ld: 0711-317 ERROR: Undefined symbol: Virtual table for class "__DynaCastDesc_si_public": first non-inline virtual function in "__DynaCastDesc_si_public" is not defined.
ld: 0711-317 ERROR: Undefined symbol: Virtual table for class "eti_cplusplus": first non-inline virtual function in "eti_cplusplus" is not defined.
ld: 0711-317 ERROR: Undefined symbol: operator delete(void*)
ld: 0711-317 ERROR: Undefined symbol: std::cout
ld: 0711-317 ERROR: Undefined symbol: .std::__setUncaughtExceptionFlag(bool)
ld: 0711-317 ERROR: Undefined symbol: .__CleanupCatch
ld: 0711-317 ERROR: Undefined symbol: .std::_Lockit::_Lockit(int)
ld: 0711-317 ERROR: Undefined symbol: .std::uncaught_exception()
ld: 0711-317 ERROR: Undefined symbol: .std::_Lockit::~_Lockit()
ld: 0711-317 ERROR: Undefined symbol: .operator delete(void*)
ld: 0711-317 ERROR: Undefined symbol: .std::ios_base::clear(int,bool)
ld: 0711-317 ERROR: Undefined symbol: std::ctype<char>::id
ld: 0711-317 ERROR: Undefined symbol: .std::locale::_Getfacet(unsigned long) const
ld: 0711-317 ERROR: Undefined symbol: .__Throw
ld: 0711-317 ERROR: Undefined symbol: .std::unexpected()
ld: 0711-317 ERROR: Undefined symbol: .std::terminate()
ld: 0711-317 ERROR: Undefined symbol: .__ReThrow
ld: 0711-317 ERROR: Undefined symbol: std::locale::id::_Id_cnt
ld: 0711-317 ERROR: Undefined symbol: .operator new(unsigned long)
ld: 0711-317 ERROR: Undefined symbol: .std::_Locinfo::_Locinfo(const char*)
ld: 0711-317 ERROR: Undefined symbol: .std::_Locinfo::~_Locinfo()
ld: 0711-317 ERROR: Undefined symbol: std::ctype<char>::_Cltab
ld: 0711-317 ERROR: Undefined symbol: ._Getctype
ld: 0711-317 ERROR: Undefined symbol: ._Tolower
ld: 0711-317 ERROR: Undefined symbol: ._Toupper
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
估计是连接库的问题
我在RH9下用cc -o hello hello.cpp -lstdc++是可以的,但在AIX下又不行,不知道要连接什么库 |
|