如何设置GTK +与code ::在Ubuntu Linux块开发 [英] How to setup GTK+ to develop with Code::Blocks on Ubuntu Linux
问题描述
我想开发在Ubuntu 11.4 GTK +应用程序,使用code :: Blocks的。
I am trying to develop a GTK+ application on Ubuntu 11.4, using Code::Blocks.
www.gtk.org对从源代码构建GTK +的指令,看起来复杂。但是,Ubuntu的软件包管理器中列出libgtk3-dev下,我安装了一个包。
www.gtk.org has instructions on building GTK+ from source, that looked complicated. But the Ubuntu package manager listed libgtk3-dev as a package that I installed.
code :: Blocks的我安装使用的是Ubuntu软件中心。
Code::Blocks I installed using the Ubuntu Software Center.
使用code :: Blocks的项目向导来创建一个GTK +项目,当我建,该项目编译失败找不到GTK / gtk.h。
Using the Code::Blocks project wizard to create a GTK+ project, when I build, the project fails to compile "cannot find gtk/gtk.h".
很明显,GTK包括(和库)文件夹不会添加到code :: Blocks的搜索文件夹。我已经找到相关的路径和文件...
Clearly the GTK include (and lib) folders are not added to the Code::Blocks search folders. I have located the relevant paths and files...
我必须明确功放&;手动添加所有的搜索路径code :: Blocks的搜索路径?还是我错过了一些安装的步骤。
Do I have to explicitly & manually add all the search paths to Code::Blocks' search paths? Or am I missing some installation step.
推荐答案
打开code :: Blocks的设置>编译器和链接器设置...并添加全局编译器设置>编译器设置>其他选项在以下p>
Open Code::Blocks Settings > Compiler and Linker Settings... and add the following under Global Compiler Settings > Compiler Settings > Other Options
`pkg-config --cflags gtk+-3.0`
和它添加到全局编译器设置>连接器设置>其他选项
and add this to Global Compiler Settings > Linker Settings > Other Options
`pkg-config --libs gtk+-3.0`
随着`这有运行pkg配置工具调用的效果 - CFLAGS GTK + -3.0
(或--libs)其中,假设libgtk3-dev的是安装后,注入必要的搜索文件夹和lib指令到gcc的命令行。
With the ` this has the effect of running the pkg-config tool calling --cflags gtk+-3.0
(or --libs) which, assuming libgtk3-dev is installed, injects the necessary search folders and lib directives onto the gcc command line.
作为替代方案, developer.ubuntu.com 的列表 Anjuta的作为可以创建GTK +项目C / C ++ IDE。作为一种替代code :: Blocks的其远抛光作为Ubuntu的IDE。
As an alternative, developer.ubuntu.com lists Anjuta as a C/C++ IDE that can create GTK+ projects. As an alternative to Code::Blocks its far more polished as an Ubuntu IDE.
换个说法。 Anjuta的迅速失去其光泽。
Scratch that. Anjuta looses its sheen quickly.
这篇关于如何设置GTK +与code ::在Ubuntu Linux块开发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!