链接错误:未定义的符号,很多(cpp 交叉编译)

发布于 2024-08-17 12:31:26 字数 2437 浏览 7 评论 0原文

我到达最后一个链接命令(实际的可执行文件正在链接),但我得到一堆未定义的符号(它们在 cpp 中,对我这个简单的 c 程序员来说看起来很可怕)

——这可能很简单,但是我无法得到我应该作为链接器放置的内容(它在这里使用 gcc...?这合适吗?g++ 告诉我太多输入文件,哈哈)(ld 返回大部分相同的内容)

无论如何,这很荒谬,我完全陷入困境,

谢谢你的帮助!

make
Making all in docs
Making all in en
make[2]: Nothing to be done for `all'.
make[2]: Nothing to be done for `all-am'.
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.0  -arch armv6 -pipe -std=c99 -Wno-trigraphs -fpascal-strings -fasm-blocks  -Wreturn-type -Wunused-variable -fmessage-length=0 -fvisibility=hidden -miphoneos-version-min=2.0 -gdwarf-2 -mthumb -miphoneos-version-min=2.0 -I../include -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.2.sdk -O0  -arch armv6 -pipe -std=c99 -gdwarf-2 -mthumb -I../include -L../libs -L../../libs -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.sdk -L/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/usr/lib  -o mutella  -L/usr/local/lib uilocalsocket.o gnumarkedfiles.o uitextmode.o sha1.o sha1thread.o gnuwordhash.o gnulogcentre.o asyncdns.o gnuwebcache.o uiterminal.o uiremote.o asyncproxysocket.o messages.o lineinput.o rcobject.o event.o term_help.o mprintf.o readline4fix.o asyncfile.o tstring.o dir.o inifile.o property.o byteorder.o mui.o gnusearch.o mthread_unix.o asyncsocket.o controller.o preferences.o packet.o gnuupload.o gnusock.o gnushare.o gnunode.o gnuhash.o gnudownload.o gnudirector.o gnucache.o conversions.o common.o main.o  -lpthread -lreadline -lcurses  -lpoll -lz
Undefined symbols:
  "std::__throw_bad_alloc()", referenced from:
      __gnu_cxx::new_allocator<std::_List_node<MUILSocketCommunicate*> >::allocate(unsigned long, void const*)in uilocalsocket.o
      __gnu_cxx::new_allocator<SMarkedFile>::allocate(unsigned long, void const*)in gnumarkedfiles.o
      __gnu_cxx::new_allocator<std::_List_node<long> >::allocate(unsigned long, void const*)in gnumarkedfiles.o
      __gnu_cxx::new_allocator<std::_Rb_tree_node<TString<char> > >::allocate(unsigned long, void const*)in gnumarkedfiles.o
      __gnu_cxx::new_allocator<std::_Rb_tree_node<long> >::allocate(unsigned long, void const*)in gnumarkedfiles.o
      __gnu_cxx::new_allocator<std::_Rb_tree_node<std::pair<long const, MFileSizeClass> > >::allocate(unsigned long, void const*)in gnumarkedfiles.o

I get to the very last linking command (the actual executable is being linked) but i get a BUNCH of undefined symbols (and they're in cpp and look so scary to me, a simple c programmer)

--its probably something simple but i cant get what im supposed to put as linker (its using gcc here...? is that appropriate? g++ told me too many input files lol) (ld returns much of the same)

anyway its ridiculous, i am completely stuck

thankyou for your help!

make
Making all in docs
Making all in en
make[2]: Nothing to be done for `all'.
make[2]: Nothing to be done for `all-am'.
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.0  -arch armv6 -pipe -std=c99 -Wno-trigraphs -fpascal-strings -fasm-blocks  -Wreturn-type -Wunused-variable -fmessage-length=0 -fvisibility=hidden -miphoneos-version-min=2.0 -gdwarf-2 -mthumb -miphoneos-version-min=2.0 -I../include -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.2.sdk -O0  -arch armv6 -pipe -std=c99 -gdwarf-2 -mthumb -I../include -L../libs -L../../libs -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.sdk -L/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/usr/lib  -o mutella  -L/usr/local/lib uilocalsocket.o gnumarkedfiles.o uitextmode.o sha1.o sha1thread.o gnuwordhash.o gnulogcentre.o asyncdns.o gnuwebcache.o uiterminal.o uiremote.o asyncproxysocket.o messages.o lineinput.o rcobject.o event.o term_help.o mprintf.o readline4fix.o asyncfile.o tstring.o dir.o inifile.o property.o byteorder.o mui.o gnusearch.o mthread_unix.o asyncsocket.o controller.o preferences.o packet.o gnuupload.o gnusock.o gnushare.o gnunode.o gnuhash.o gnudownload.o gnudirector.o gnucache.o conversions.o common.o main.o  -lpthread -lreadline -lcurses  -lpoll -lz
Undefined symbols:
  "std::__throw_bad_alloc()", referenced from:
      __gnu_cxx::new_allocator<std::_List_node<MUILSocketCommunicate*> >::allocate(unsigned long, void const*)in uilocalsocket.o
      __gnu_cxx::new_allocator<SMarkedFile>::allocate(unsigned long, void const*)in gnumarkedfiles.o
      __gnu_cxx::new_allocator<std::_List_node<long> >::allocate(unsigned long, void const*)in gnumarkedfiles.o
      __gnu_cxx::new_allocator<std::_Rb_tree_node<TString<char> > >::allocate(unsigned long, void const*)in gnumarkedfiles.o
      __gnu_cxx::new_allocator<std::_Rb_tree_node<long> >::allocate(unsigned long, void const*)in gnumarkedfiles.o
      __gnu_cxx::new_allocator<std::_Rb_tree_node<std::pair<long const, MFileSizeClass> > >::allocate(unsigned long, void const*)in gnumarkedfiles.o

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

堇色安年 2024-08-24 12:31:26

似乎您正在尝试将 C++ 代码与 C (gcc) 链接器调用链接起来。这不会包括您所看到的适当的库。尝试使用 g++ 而不是 gcc(或者扔掉 C++ 代码/库)。

Seems you are trying to link C++ code with a C (gcc) linker call. That'll not include the appropriate libraries which is just what you are seeing. Try g++ instead of gcc (or throw out the C++ code/libraries).

一紙繁鸢 2024-08-24 12:31:26

添加 -lstdc++ 或使用 g++ 进行链接。

Add -lstdc++ or use g++ for linking.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文