linux - 将 gtkmm 与 Eclipse CDT 结合使用

标签 linux eclipse gtkmm

我正在尝试编译 gtkmm Simple Example使用 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

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

最佳答案

项目属性->C/C++ 构建->设置 GCC C++ Compiler->Miscellaneous,将此字符串:pkg-config gtkmm-3.0 --cflags --libs 添加到 Other flags 中。 GCC C++ Linker->Miscellaneous,在 Linker flags 中添加以下字符串:pkg-config gtkmm-3.0 --cflags --libs。 如果您使用的是 gtkmm 2.4,只需将“gtkmm-3.0”替换为“gtkmm-2.4”

勾选 GCC C++ COMPILER VERBOSE (_V) 字符串。

关于linux - 将 gtkmm 与 Eclipse CDT 结合使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4957396/

相关文章:

java - Android 从 SettingsActivity 中删除类别而不会使应用程序崩溃?

java.lang.ClassNotFoundException : com. mysql.jdbc.Driver 错误,即使在导入库之后

c++ - 与 g_signal_handlers_block_by_func() 等价的 gtkmm 是什么?

linux - 4 行在包含许多文件的目录中反转 grep 搜索

ruby - 您如何将 logrotate 与输出重定向一起使用?

c - 随机发生器

Ubuntu 22.04 上的 Eclipse 2022-06 启动问题

linux - Golang 在提示时输入 SSH Sudo 密码(或退出)

c++ - 破坏 Glib::RefPtr 会导致 GTK 3 核心中的断言失败

c++ - 网格中的 GTKMM 按钮