gtkmm编译错误 [英] Gtkmm compiling error

查看:122
本文介绍了gtkmm编译错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

操作系统:Windows 7

OS: Windows 7

编译器:MinGW

IDE:代码::块

我刚刚在计算机上的文件夹C:/gtkmm/中安装了Gtkmm,并设置了示例程序.当我编译它时,它给出了错误"gtkmm.h:没有这样的文件或目录"

I just installed Gtkmm on my computer in the folder C:/gtkmm/ and set up an example program. When I compiled it, it gave the error "gtkmm.h: No such file or directory"

我尝试将PATH变量设置为C:/gtkmm/include和C:/gtkmm/gtkmm-2.4,但均无济于事.然后,我尝试使用#include"C:/gtkmm/include/gtkmm-2.4/gtkmm.h",这只是产生了很多错误,表明它不知道几十个文件在哪里.

I tried setting the PATH variable to C:/gtkmm/include and C:/gtkmm/gtkmm-2.4, but neither worked. Then I tried using #include "C:/gtkmm/include/gtkmm-2.4/gtkmm.h" and that just gave a ton of errors saying that it doesn't know where a few dozen files are.

我还听说您需要在编译器选项中放入pkg-config gtkmm-2.4 --cflags --libs,但这也不起作用.

I've also heard that you need to put pkg-config gtkmm-2.4 --cflags --libs in the compiler options, but that didn't work either.

我在做错什么以及如何解决?

What am I doing wrong and how do I fix it?

推荐答案

pkg-config是一个辅助函数,用于将cflags和lib路径添加到编译器行中.

pkg-config is a helper function for adding cflags and lib paths to the compiler line.

您需要做的是将库和cflags路径添加到编译器行.不过,我不确定100%如何在code :: blocks中做到这一点.

What you will need to do is add the libraries and cflags path to the compiler line. I am not 100% sure how to do that in code::blocks., though

在ubuntu 11.04中,您甚至还需要所有这些来编译一个简单的gtkmm程序:

In ubuntu 11.04, you need all these to compile even a simple gtkmm program:

库(pkg-config --libs gtkmm-2.4:

Libs (pkg-config --libs gtkmm-2.4:

-pthread -lgtkmm-2.4 -latkmm-1.6 -lgdkmm-2.4 -lgiomm-2.4 -lpangomm-1.4 -lgtk-x11-2.0 -lglibmm-2.4 -lcairomm-1.0 -lsigc-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lm -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lrt -lglib-2.0

cflags路径(pkg-config --clfags gtkmm-2.4):

cflags paths (pkg-config --clfags gtkmm-2.4):

-I/usr/include/atk-1.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pango-1.0 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/gio-unix-2.0/ -I/usr/include/gtkmm-2.4 -I/usr/lib/gtkmm-2.4/include -I/usr/include/atkmm-1.6 -I/usr/include/giomm-2.4 -I/usr/lib/giomm-2.4/include -I/usr/include/pangomm-1.4 -I/usr/lib/pangomm-1.4/include -I/usr/include/gtk-2.0 -I/usr/include/gtk-unix-print-2.0 -I/usr/include/gdkmm-2.4 -I/usr/lib/gdkmm-2.4/include -I/usr/include/glibmm-2.4 -I/usr/lib/glibmm-2.4/include -I/usr/include/sigc++-2.0 -I/usr/lib/sigc++-2.0/include -I/usr/include/cairomm-1.0 -I/usr/lib/cairomm-1.0/include -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/lib/gtk-2.0/include -I/usr/include/gdk-pixbuf-2.0

基本上,您必须将/usr/include//usr/lib/的每个实例更改为c:\path-to-library\

Basically you would have to change every instance of /usr/include/ and /usr/lib/ to c:\path-to-library\

我不确定使用MinGW需要多少上述内容,但是使用Linux上的GCC,删除其中的任何一个都会使gtkmm程序无法编译.希望至少能让您走上正确的道路.

I am not sure how much of the above you need with MinGW, but with GCC on Linux, dropping any of them makes gtkmm programs not compile. Hope that at least puts you on the right path.

这篇关于gtkmm编译错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆