本文介绍了在Eclipse中为C ++设置GTKmm的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在Eclipse中使用GTKmm创建一个GUI,但是我无法使配置工作。作为参考,这里是我的实际代码:

I am trying to create a GUI using GTKmm in Eclipse, however I can't get the configuration working. For reference, here is my actual code:

#include <gtkmm.h>

using namespace std;

int main(int argc, char **argv) {
    Gtk::Main kit(argc,argv);
    Gtk::Window frmMain;

    kit.run(frmMain);

    return 0;
}

这些是我在GCC C ++编译器部分下输入的设置。
所有选项:

These are the settings I have entered under the GCC C++ Compiler section.All options:

-I/usr/include/gtkmm-3.0 -I/usr/include/gdkmm-3.0 -I/usr/include/gtk-3.0 -O0 -g3 -Wall

和命令行模式:

${COMMAND} `pkg-config gtkmm-3.0 --cflags` ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}

最后,在GCC G ++链接器部分,我为命令行模式输入:

Finally, under the GCC G++ Linker section, I have this entered for the Command Line Pattern:

${COMMAND} `pkg-config gtkmm-3.0 --libs` ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS} ${FLAGS}

这是一个链接到我的编译日志:

Here is a link to my compile log:http://pastebin.com/tfqv97w6

推荐答案

我进行了两次测试。一个来自您的源实例,一个来自站点的简单文件。两人都第一次使用以下步骤完美地工作。

I performed two test. One with your source instance and one with an instance from a simple file from the site. Both worked flawlessly the first time using the steps below.

来自gtkmm网站的Hello World示例与成功:

A Hello World example from the gtkmm website with Success:https://git.gnome.org/browse/gtkmm-documentation/tree/examples/book/helloworld

首先我安装了pkg-config Eclipse插件:

First I installed the pkg-config Eclipse Plugin:
https://code.google.com/p/pkg-config-support-for-eclipse-cdt/

然后:


  • 在Eclipse中创建一个新的空C ++项目

  • 向项目添加了三个文件( helloworld.cpp helloworld.h
    main.cc

  • 向项目添加了pkg-config-support:[(右键单击在项目中) - >属性 - > C ++
    构建 - >设置 - > Pkg-config - >(复选标记)gtkmm-3.0 - >确定

  • 从Eclipse我清理,然后构建所有,然后才能够运行
    示例。

  • Created a new empty C++ project in Eclipse
  • Added three files to the project (helloworld.cpp, helloworld.h,main.cc)
  • Added pkg-config-support to the project: [(right click on Project) -> Properties -> C++Build -> Settings -> Pkg-config -> (checkmark) gtkmm-3.0 -> OK
  • From Eclipse I Cleaned, then Build all, then was able to Run theexample.

这篇关于在Eclipse中为C ++设置GTKmm的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 17:49