linux – 使用带有Eclipse CDT的gtkmm
作者:互联网
我正在尝试使用Eclipse CDT编译gtkmm Simple Example,但由于某种原因它无法正常工作
我正在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
很抱歉长错误日志,但我不知道如何缩短它
解决方法:
项目属性 – > C/C++构建 – >设置
GCC C Compiler->杂项,将此字符串添加:pkg-config gtkmm-3.0 –cflags –libs into Other flags.
GCC C Linker->杂项,在链接器标志中添加此字符串:pkg-config gtkmm-3.0 –cflags –libs.
如果您使用的是gtkmm 2.4,只需将“gtkmm-3.0”替换为“gtkmm-2.4”
勾选GCC C COMPILER VERBOSE(_V)字符串.
标签:linux,eclipse,gtkmm 来源: https://codeday.me/bug/20190621/1256000.html