GCC奇怪的链接器错误..适用于Visual Studio 2010

que*_*ons 0 c++ linker gcc visual-studio-2010

我使用gcc得到这个奇怪的链接器错误,认为我使用Visual Studio时代码工作正常.

/tmp/ccfcdCxg.o: In function `global constructors keyed to main':
codechef_permut2.cpp:(.text+0xa): undefined reference to `std::ios_base::Init::Init()'
codechef_permut2.cpp:(.text+0x19): undefined reference to `std::ios_base::Init::~Init()'
/tmp/ccfcdCxg.o: In function `ambig(unsigned long)':
codechef_permut2.cpp:(.text+0x47): undefined reference to `operator new[](unsigned long)'
codechef_permut2.cpp:(.text+0x52): undefined reference to `operator new[](unsigned long)'
/tmp/ccfcdCxg.o:(.eh_frame+0x12): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status
Run Code Online (Sandbox Code Playgroud)

我发布任何代码,因为我觉得它不是必需的,但如果有人觉得我会发布它.

Mik*_*our 8

我的猜测是你正在使用gcc而不是g++链接你的程序.gcc除非你告诉它,否则不会包含C++库; g++将.