dinkumware 402与g ++ 3.x / _Winit undefined ref链接 [英] dinkumware 402 linking with g++ 3.x/ _Winit undefined ref

查看:35
本文介绍了dinkumware 402与g ++ 3.x / _Winit undefined ref链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




使用

g ++(版本3.2.3或3.3)和dinkumware 402链接一个简单的hello world程序时遇到一些问题。


// hallo world ...

#include< iostream>

main(){

std :: cout<< " BLA" << std :: endl;

}


//链接就是那种......

g ++ -I。 / dinkumware_co / include ./libgcc_v3.2_c99_standard.a test.cpp


然后我得到:


/usr/tmp/cct8tLwS.o :在函数中

`__static_initialization_and_destruction_0(int,int)'':

/usr/tmp/cct8tLwS.o(.text+0x74):对

`std :: _ Winit :: _ Winit [负责]()''

/usr/tmp/cct8tLwS.o(.text+0x8f):对br的未定义引用/>
`std :: _ Winit ::〜_Winit

[主管]()''

/usr/tmp/cct8tLwS.o:In function`std :: basic_ios< char,

std :: char_traits< char>

Hi,

I have some problems to link a simple hello world program using
g++ (version 3.2.3 or 3.3) and dinkumware 402.

//hallo world...
#include <iostream>
main () {
std::cout << "bla" << std::endl;
}

// the linking is something of that kind...
g++ -I./dinkumware_co/include ./libgcc_v3.2_c99_standard.a test.cpp

then I get:

/usr/tmp/cct8tLwS.o: In function
`__static_initialization_and_destruction_0(int, int)'':
/usr/tmp/cct8tLwS.o(.text+0x74): undefined reference to
`std::_Winit::_Winit[in-charge]()''
/usr/tmp/cct8tLwS.o(.text+0x8f): undefined reference to
`std::_Winit::~_Winit
[in-charge]()''
/usr/tmp/cct8tLwS.o: In function `std::basic_ios<char,
std::char_traits<char>

:: clear(std :: _ Iosb< int> :: _ Iostate,bool)' ':
::clear(std::_Iosb<int>::_Iostate, bool)'':



/usr/tmp/cct8tLwS.o(.gnu.linkonce.t._ZNSt9basic_iosIcSt11ch ar_traitsIcEE5clearENSt5_IosbIiE8_IostateEb + 0x3c):

未定义对`std的引用: :ios_base :: clear(std :: _ Iosb< int> :: _ Iostate,

boo l)''

/usr/tmp/cct8tLwS.o:在函数`std :: ctype< char>中const&

std :: use_facet< std :: ctype< char> >(std :: locale const&)'':

/usr/tmp/cct8tLwS.o(.gnu.linkonce.t._ZSt9use_facetISt5ctype IcEERKT_RKSt6locale + 0x3f):

未定义引用`std :: locale :: _ Getfacet(unsigned)const''

/usr/tmp/cct8tLwS.o(.gnu.linkonce.t._ZSt9use_facetISt5ctype IcEERKT_RKSt6locale + 0xee):

undefined对`std :: locale :: facet :: _ Register()的引用''

/usr/tmp/cct8tLwS.o:在函数`std :: locale :: id :: operator unsigned()'':

/usr/tmp/cct8tLwS.o(.gnu.linkonce.t._ZNSt6locale2idcvjEv+0x 2e):undefined

参考到'std :: locale :: id :: _ Id_cnt''

/usr/tmp/cct8tLwS.o(.gnu.linkonce.t._ZNSt6locale2idcvjEv+0x 33):undefined

引用`std :: locale :: id :: _ Id_cnt''

/usr/tmp/cct8tLwS.o:函数`std :: ctype< char> :: ctype [in -charge](简短

const *,bool,unsigned)'':

/usr/tmp/cct8tLwS.o(.gnu.linkonce.t._ZNSt5ctypeIcEC1EPKsbj+ 0x37) :undefined

refe rence to`std :: _ Locinfo :: _ Locinfo [in-charge](char const *)''

/usr/tmp/cct8tLwS.o(.gnu.linkonce.t._ZNSt5ctypeIcEC1EPKsbj+ 0x5c): undefined

引用`std :: _ Locinfo ::〜_Locinfo [负责]()''

/usr/tmp/cct8tLwS.o(.gnu.linkonce .t._ZNSt5ctypeIcEC1EPKsbj + 0x6c):undefined

引用`std :: _ Locinfo ::〜_Locinfo [负责]()''

collect2:ld返回1退出状态


/usr/tmp/cct8tLwS.o(.gnu.linkonce.t._ZNSt9basic_iosIcSt11ch ar_traitsIcEE5clearENSt5_IosbIiE8_IostateEb+0x3c):
undefined reference to `std::ios_base::clear(std::_Iosb<int>::_Iostate,
bool)''
/usr/tmp/cct8tLwS.o: In function `std::ctype<char> const&
std::use_facet<std::ctype<char> >(std::locale const&)'':
/usr/tmp/cct8tLwS.o(.gnu.linkonce.t._ZSt9use_facetISt5ctype IcEERKT_RKSt6locale+0x3f):
undefined reference to `std::locale::_Getfacet(unsigned) const''
/usr/tmp/cct8tLwS.o(.gnu.linkonce.t._ZSt9use_facetISt5ctype IcEERKT_RKSt6locale+0xee):
undefined reference to `std::locale::facet::_Register()''
/usr/tmp/cct8tLwS.o: In function `std::locale::id::operator unsigned()'':
/usr/tmp/cct8tLwS.o(.gnu.linkonce.t._ZNSt6locale2idcvjEv+0x 2e): undefined
reference to `std::locale::id::_Id_cnt''
/usr/tmp/cct8tLwS.o(.gnu.linkonce.t._ZNSt6locale2idcvjEv+0x 33): undefined
reference to `std::locale::id::_Id_cnt''
/usr/tmp/cct8tLwS.o: In function `std::ctype<char>::ctype[in-charge](short
const*, bool, unsigned)'':
/usr/tmp/cct8tLwS.o(.gnu.linkonce.t._ZNSt5ctypeIcEC1EPKsbj+ 0x37): undefined
reference to `std::_Locinfo::_Locinfo[in-charge](char const*)''
/usr/tmp/cct8tLwS.o(.gnu.linkonce.t._ZNSt5ctypeIcEC1EPKsbj+ 0x5c): undefined
reference to `std::_Locinfo::~_Locinfo [in-charge]()''
/usr/tmp/cct8tLwS.o(.gnu.linkonce.t._ZNSt5ctypeIcEC1EPKsbj+ 0x6c): undefined
reference to `std::_Locinfo::~_Locinfo [in-charge]()''
collect2: ld returned 1 exit status

推荐答案

尝试不用std ::


" david" < d ******* @ callassoftware.com>在消息中写道

news:br ********** @ news1.transmedia.de ...
Try without std::

"david" <d.*******@callassoftware.com> wrote in message
news:br**********@news1.transmedia.de...

我使用
g ++(版本3.2.3或3.3)和dinkumware 402链接一个简单的hello world程序有一些问题。

//你好世界......
#包括< iostream>
main(){
std :: cout<< " BLA" << std :: endl;
}
//链接是那种......
g ++ -I./dinkumware_co/include ./libgcc_v3.2_c99_standard.a test .cpp
然后我得到:

/usr/tmp/cct8tLwS.o:在功能中
`__static_initialization_and_destruction_0(int,int)'':
/usr/tmp/cct8tLwS.o(.text+0x74):未定义引用
`std :: _ Winit :: _ Winit [主管]()''
/ usr / tmp / cct8tLwS .o(。text + 0x8f):未定义引用
`std :: _ Winit ::〜_Winit
[主管]()''
/usr/tmp/cct8tLwS.o :在函数`std :: basic_ios< char,
std :: char_traits< char>
Hi,

I have some problems to link a simple hello world program using
g++ (version 3.2.3 or 3.3) and dinkumware 402.

//hallo world...
#include <iostream>
main () {
std::cout << "bla" << std::endl;
}

// the linking is something of that kind...
g++ -I./dinkumware_co/include ./libgcc_v3.2_c99_standard.a test.cpp

then I get:

/usr/tmp/cct8tLwS.o: In function
`__static_initialization_and_destruction_0(int, int)'':
/usr/tmp/cct8tLwS.o(.text+0x74): undefined reference to
`std::_Winit::_Winit[in-charge]()''
/usr/tmp/cct8tLwS.o(.text+0x8f): undefined reference to
`std::_Winit::~_Winit
[in-charge]()''
/usr/tmp/cct8tLwS.o: In function `std::basic_ios<char,
std::char_traits<char>
:: clear(std :: _ Iosb< int> :: _ Iostate,bool)'':
::clear(std::_Iosb<int>::_Iostate, bool)'':



/usr/tmp/cct8tLwS.o(.gnu.linkonce.t._ZNSt9basic_iosIcSt11ch ar_traitsIcEE5cle

arENSt5_IosbIiE8_IostateEb + 0x3c):对`std ::的未定义引用ios_base :: clear(std :: _ Iosb< int> :: _ Iostate,
bool)''
/usr/tmp/cct8tLwS.o:函数`std :: ctype< char> const&
std :: use_facet< std :: ctype< char> >(std :: locale const&)'':

/usr/tmp/cct8tLwS.o(.gnu.linkonce.t._ZSt9use_facetISt5ctype IcEERKT_RKSt6loca

le + 0x3f ):未定义引用`std :: locale :: _ Getfacet(unsigned)const''

/usr/tmp/cct8tLwS.o(.gnu.linkonce.t._ZSt9use_facetISt5ctype IcEERKT_RKSt6loca

le + 0xee):未定义引用`std :: locale :: facet :: _ Register()''
/usr/tmp/cct8tLwS.o:在函数`std :: locale :: id中: :operator unsigned()'':
/usr/tmp/cct8tLwS.o(.gnu.linkonce.t._ZNSt6locale2idcvjEv+0x 2e):undefined
对`std :: locale :: id的引用: :_Id_cnt''
/usr/tmp/cct8tLwS.o(.gnu.linkonce.t._ZNSt6locale2idcvjEv+0x 33):undefined
对`std :: locale :: id :: _ Id_cnt''的引用
/usr/tmp/cct8tLwS.o:函数`std :: ctype< char> :: ctype [in-charge](简短
const *,bool,unsigned)'':
/usr/tmp/cct8tLwS.o(.gnu.linkonce.t._ZNSt5ctypeIcEC1EPKsbj+ 0x37):
undefined对`std :: _ Locinfo :: _ Locinfo [in-charge]的引用(char const *)''
/usr/tmp/cct8tLwS.o(.gnu.linkonce.t._ZNSt5ctypeIcEC1EPKsbj+ 0x5c):
未定义对`std :: _ Locinfo ::〜_Locinfo的引用[in-收费]()''
/usr/tmp/cct8tLwS.o(.gnu.linkonce.t._ZNSt5ctypeIcEC1EPKsbj+ 0x6c):
未定义对`std :: _ Locinfo ::〜_Locinfo [in-charge]的引用]()''
collect2:ld返回1退出状态


/usr/tmp/cct8tLwS.o(.gnu.linkonce.t._ZNSt9basic_iosIcSt11ch ar_traitsIcEE5cle
arENSt5_IosbIiE8_IostateEb+0x3c): undefined reference to `std::ios_base::clear(std::_Iosb<int>::_Iostate,
bool)''
/usr/tmp/cct8tLwS.o: In function `std::ctype<char> const&
std::use_facet<std::ctype<char> >(std::locale const&)'':
/usr/tmp/cct8tLwS.o(.gnu.linkonce.t._ZSt9use_facetISt5ctype IcEERKT_RKSt6loca
le+0x3f): undefined reference to `std::locale::_Getfacet(unsigned) const''
/usr/tmp/cct8tLwS.o(.gnu.linkonce.t._ZSt9use_facetISt5ctype IcEERKT_RKSt6loca
le+0xee): undefined reference to `std::locale::facet::_Register()''
/usr/tmp/cct8tLwS.o: In function `std::locale::id::operator unsigned()'':
/usr/tmp/cct8tLwS.o(.gnu.linkonce.t._ZNSt6locale2idcvjEv+0x 2e): undefined
reference to `std::locale::id::_Id_cnt''
/usr/tmp/cct8tLwS.o(.gnu.linkonce.t._ZNSt6locale2idcvjEv+0x 33): undefined
reference to `std::locale::id::_Id_cnt''
/usr/tmp/cct8tLwS.o: In function `std::ctype<char>::ctype[in-charge](short
const*, bool, unsigned)'':
/usr/tmp/cct8tLwS.o(.gnu.linkonce.t._ZNSt5ctypeIcEC1EPKsbj+ 0x37): undefined reference to `std::_Locinfo::_Locinfo[in-charge](char const*)''
/usr/tmp/cct8tLwS.o(.gnu.linkonce.t._ZNSt5ctypeIcEC1EPKsbj+ 0x5c): undefined reference to `std::_Locinfo::~_Locinfo [in-charge]()''
/usr/tmp/cct8tLwS.o(.gnu.linkonce.t._ZNSt5ctypeIcEC1EPKsbj+ 0x6c): undefined reference to `std::_Locinfo::~_Locinfo [in-charge]()''
collect2: ld returned 1 exit status





Igor Malner写道:

Igor Malner wrote:
尝试不用std ::
Try without std::






抱歉这不能解决问题。我仍然有相同的undefined

引用!


然后我必须在std之后添加行包括:


using namespace std;


重要:

如果包含路径未指向dinkumware的正确路径

库,然后它工作 - 至少在第一个视图中看起来如此 - 但是

然后它与由g ++分发的libstdc ++链接,而不是与

dinkumware库链接!

David


Hi

sorry this does not solve the Problem. I still have the same undefined
references!

I then have to add the line after the std include:

using namespace std;

Important:
If the include path is not pointing to the correct path of the dinkumware
library, then it "works" - at least it seems so in the first view - , but
then it is linked with the libstdc++ distributed by g++, and not with the
dinkumware library!
David


david写道:


我有一些问题使用
g ++(版本3.2.3或3.3)和dinkumware 402链接一个简单的hello world程序。

// hallo world ...
#include< iostream>
main(){
std :: cout<< " BLA" << std :: endl;
}
Hi,

I have some problems to link a simple hello world program using
g++ (version 3.2.3 or 3.3) and dinkumware 402.

//hallo world...
#include <iostream>
main () {
std::cout << "bla" << std::endl;
}




我猜它扼杀了你定义的main()不是

实际上是一个函数定义。试试这个:


#include< iostream>

int main(){

std :: cout<< " BLA" << std :: endl;

返回0;

}


注意:int是main的* only *有效返回类型()。 void main()不是,

从来没有,也永远不会是有效的C ++。对于main()没有返回类型

它是相同的故事。 Afaik,你能做的唯一功能(必须,甚至)

声明没有返回类型的是构造函数和析构函数。


-

Unforgiven



I''m guessing it chokes on the fact that the main() you have defined is not
actually a function definition. Try this:

#include <iostream>
int main() {
std::cout << "bla" << std::endl;
return 0;
}

NOTE: int is the *only* valid return type for main(). void main() is not,
never has been, and never will be, valid C++. For main() without return type
it''s the same story. Afaik, the only functions that you can (must, even)
declare without return type are constructors and destructors.

--
Unforgiven


这篇关于dinkumware 402与g ++ 3.x / _Winit undefined ref链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆