2011-02-10 85 views
4

我试图编译使用Eclipse CDT的gtkmm的Simple Example,但它不工作由于某种原因使用的gtkmm与Eclipse CDT

我上的Mandriva Linux和GCC 4.4.3编译这个

我得到这个错误,我认为这是一个错误链接:

Building target: Test 
Invoking: GCC C++ Linker 
g++ -L/usr/include/gtkmm-2.4 -o"Test" ./test.o 
./test.o: In function `main': 
test.cpp:(.text+0x39): undefined reference to `Gtk::Main::Main(int&, char**&, bool)' 
test.cpp:(.text+0x43): undefined reference to `Gtk::Window::Window(Gtk::WindowType)' 
test.cpp:(.text+0x4b): undefined reference to `Gtk::Main::run(Gtk::Window&)' 
test.cpp:(.text+0x53): undefined reference to `Gtk::Window::~Window()' 
test.cpp:(.text+0x5b): undefined reference to `Gtk::Main::~Main()' 
test.cpp:(.text+0x82): undefined reference to `Gtk::Main::~Main()' 
test.cpp:(.text+0x95): undefined reference to `Gtk::Window::~Window()' 
./test.o: In function `global constructors keyed to main': 
test.cpp:(.text+0xaf): undefined reference to `Glib::ustring::ustring(char const*)' 
test.cpp:(.text+0xbe): undefined reference to `Glib::ustring::~ustring()' 
test.cpp:(.text+0xd2): undefined reference to `Glib::ustring::ustring(char const*)' 
test.cpp:(.text+0xe1): undefined reference to `Glib::ustring::~ustring()' 
test.cpp:(.text+0xf5): undefined reference to `Glib::ustring::ustring(char const*)' 
test.cpp:(.text+0x104): undefined reference to `Glib::ustring::~ustring()' 
test.cpp:(.text+0x118): undefined reference to `Glib::ustring::ustring(char const*)' 
test.cpp:(.text+0x127): undefined reference to `Glib::ustring::~ustring()' 
test.cpp:(.text+0x13b): undefined reference to `Glib::ustring::ustring(char const*)' 
test.cpp:(.text+0x14a): undefined reference to `Glib::ustring::~ustring()' 
test.cpp:(.text+0x15e): undefined reference to `Glib::ustring::ustring(char const*)' 
test.cpp:(.text+0x16d): undefined reference to `Glib::ustring::~ustring()' 
test.cpp:(.text+0x181): undefined reference to `Glib::ustring::ustring(char const*)' 
test.cpp:(.text+0x190): undefined reference to `Glib::ustring::~ustring()' 
collect2: ld returned 1 exit status 
make: *** [Test] Error 1 

很抱歉的长期错误日志,但我不知道如何使它更短

+0

你在做什么这里说:http://library.gnome.org/devel/gtkmm-tutorial/unstable/sec-install-unix-and-linux.html.en – yasouser 2011-02-10 15:46:38

+0

我已经安装了devel软件包,或者你的意思是我应该从源代码编译它? – 2011-02-10 17:47:38

回答

1

你要添加的所有日当您在终端中运行pkg-config gtkmm-2.4 --cflags --libs时,e库会列出。据我所知,Eclipse与pkg-config不兼容,所以你必须手动添加它们。

右键单击您的项目>属性> C/C++编译>设置

在GCC C++编译器,在目录中,加列出的每个目录,当你运行 pkg-config gtkmm-2.4 --cflags (只是目录,删除-I和 - 并行线程)

在GCC C++链接,图书馆,从 pkg-config --libs (再次添加一切,只是添加库,删除-l和-pthread)

+0

如何找出哪些目录使用pkg-config列出? – 2011-03-21 16:27:06

4

项目镨operty-> C/C++ Build->设置 GCC C++编译器 - >其他,将这个字符串:pkg-config gtkmm-3.0 --cflags --libs添加到其他标志中。 GCC C++链接器 - >其他,在链接器标志中添加此字符串:pkg-config gtkmm-3.0 --cflags --libs。 如果您使用gtkmm 2.4,只需将“gtkmm-3.0”替换为“gtkmm-2.4”

勾选GCC C++编译器VERBOSE(_V)字符串。