2010-03-03 224 views
2

我最近試圖移植一個C++應用程序。我相信我擁有它所有的依賴關係,並且它都可以編譯。但是,當它連接它時,我會遇到很多奇怪的未定義參考錯誤。奇怪的問題移植應用程序。標準庫中未定義的引用錯誤

/usr/local/lib/libglibmm-2.4.so.7.0: undefined reference to `std::basic_istream<char, std::char_traits<char> >::seekg(long, std::_Ios_Seekdir)' 
/usr/local/lib/libglibmm-2.4.so.7.0: undefined reference to `std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::_S_empty_rep_storage' 
/usr/local/lib/libxml++-2.6.so.0.1: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_S_empty_rep_storage' 
/usr/local/lib/libxml++-2.6.so.0.1: undefined reference to `std::__default_alloc_template<true, 0>::deallocate(void*, unsigned long)' 

什麼會導致這種錯誤?鏈接錯誤意味着什麼?我實在無法理解的複雜模板的錯誤消息GCC給..

在它的連接命令是全部:

gmake[3]: Entering directory `/home/earlz/synfig-0.62.00/src/tool' 
/bin/sh ../../libtool --tag=CXX --mode=link eg++ -I/usr/local/include/libxml++-2.6 -I/usr/local/lib/libxml++-2.6/include -I/usr/local/include/libxml2 -I/usr/local/include -I/usr/local/include/glibmm-2.4 -I/usr/local/lib/glibmm-2.4/include -I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include -I/usr/local/include/sigc++-2.0 -I/usr/local/lib/sigc++-2.0/include -I/usr/local/include -I/usr/local/include/sigc++-2.0 -I/usr/local/lib/sigc++-2.0/include -DSYNFIG_NO_DEPRECATED -DLOCALEDIR=\"/usr/local/share/locale\" -DNDEBUG -O2 -W -Wall -o synfig synfig-main.o ../synfig/libsynfig.la -L/usr/local/lib -lxml++-2.6 -lxml2 -lglibmm-2.4 -lgobject-2.0 -lglib-2.0 -lintl -liconv -lsigc-2.0 -lpthread -L/usr/local/lib -lsigc-2.0 -L/usr/local/lib -lintl -L/usr/local/lib -liconv -lpthread 
libtool: link: eg++ -I/usr/local/include/libxml++-2.6 -I/usr/local/lib/libxml++-2.6/include -I/usr/local/include/libxml2 -I/usr/local/include -I/usr/local/include/glibmm-2.4 -I/usr/local/lib/glibmm-2.4/include -I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include -I/usr/local/include/sigc++-2.0 -I/usr/local/lib/sigc++-2.0/include -I/usr/local/include -I/usr/local/include/sigc++-2.0 -I/usr/local/lib/sigc++-2.0/include -DSYNFIG_NO_DEPRECATED -DLOCALEDIR=\"/usr/local/share/locale\" -DNDEBUG -O2 -W -Wall -o .libs/synfig synfig-main.o -L../synfig/.libs -lsynfig -L/usr/local/lib -lxml++-2.6 -lxml2 -lm -lz -lglibmm-2.4 -lgmodule-2.0 -lgobject-2.0 -lglib-2.0 -lpcre -lsigc-2.0 -lintl -liconv -lpthread -Wl,-rpath,/usr/local/lib 

另外,我沒有得到任何形式的連接丟失的文件的錯誤,只是關於奇怪的字符串和文件流的東西丟失的東西

+1

你把它與'g ++'命令聯繫起來嗎? – jpalecek 2010-03-03 14:13:29

+1

如果您向我們顯示您用來鏈接您的應用程序的命令,它將幫助您更快地給出答案 – Glen 2010-03-03 14:15:45

+0

是的,它似乎使用g ++(注意我使用eg ++作爲命令名,因爲這是如何訪問gcc- 4.2在我的系統上) – Earlz 2010-03-03 14:19:45

回答

2

使用g ++鏈接C++應用程序,將C++標準庫添加到鏈接階段。

+0

這是否來自標準庫沒有鏈接?這是一個奇怪的錯誤。我不明白這個應用程序是如何在其他平臺上構建的。 (在Linux上編譯,但在OpenBSD上打破這個錯誤) – Earlz 2010-03-03 14:13:47

+0

你的鏈接器抱怨的名字讓它這麼想。 – AProgrammer 2010-03-03 14:17:38

+0

因此,我手修改鏈接命令來查看'/ usr/lib'並鏈接到'-lstdC++'中,它的工作原理..怪異怪異.. – Earlz 2010-03-03 14:24:36

相關問題