Re: Re: Re: GCC link problem help!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Jonathan Wakely,

   Tanks for your explain about these parameter use! Now, we adjusted our paramter noly to use -lstdc++, and we use G++ to link our program. But our program still can  not work well, it sames that related with our program size. If we add any code to our project, it can cause the problem again.
   




发件人:Jonathan Wakely <jwakely.gcc@xxxxxxxxx>
发送时间:2021-10-21 20:34
主题:Re: Re: GCC link problem help!
收件人:"Xi Ruoyao"<xry111@xxxxxxxxxxxxxxxx>
抄送:"桂永林/图灵研究院软件三部/图灵研究院"<guiyonglin@xxxxxxxxxx>,"LIU Hao"<lh_mouse@xxxxxxx>,"Tom Kacvinsky"<tkacvins@xxxxxxxxx>,"gcc-help"<gcc-help@xxxxxxxxxxx>,"柳茂昕/图灵研究院软件三部/图灵研究院"<liumaoxin@xxxxxxxxxx>,"李闯闯/图灵研究院软件三部/图灵研究院"<lichuangchuang@xxxxxxxxxx>,"汤汝/图灵研究院软件三部/图灵研究院"<tangru@xxxxxxxxxx>
 
On Thu, 21 Oct 2021 at 13:06, Xi Ruoyao via Gcc-help 
<gcc-help@xxxxxxxxxxx> wrote: 
> 
> On Thu, 2021-10-21 at 11:36 +0800, 桂永林 wrote: 
> > If there is some special parameter we need check, when we link the c++ 
> > lib to C program with C linker? 
> 
> -lstdc++ is enough as you've already disabled exception and rtti. If 
> exception or rtti is used, -lsupc++ is also needed. 
 
No, everything in libsupc++ is also included in libstdc++ so you do 
not need both. 
 
libsupc++ is for when you *only* want the language support, not the 
library utilities like iostreams, std::string, std::list etc. 
 
But libsupc++ is not just for exceptions and RTTI, it's also new and 
delete, and initialization of local static variables. So if you 
haven't used -lstdc++ then you need -lsupc++ to be able to use those 
basic features. If you have used -lstdc++, you don't need -lsupc++ for 
anything. 
 
If you simply use g++ to link instead of gcc then you get -lstdc++ 
automatically. That's the recommended way to link a program that has 
C++ components. 
 
Since you've only told us that "the program have runtime logic problem 
sometimes" nobody can really help you. That's too vague for us to know 
what the problem is. 




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux