⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gtkfaq.sgml

📁 gtk是linux一款强大的夸平台的图形化开发工具
💻 SGML
📖 第 1 页 / 共 5 页
字号:
that neither <verb>/usr/lib</verb> or <verb>/usr/local/lib</verb> contain any ofthe libraries libgtk, libgdk, libglib, or libgck.  If they do exist, remove them(and any gtk include files, such as /usr/include/gtk and /usr/include/gdk) and reinstall gtk+.</itemize><!-- ----------------------------------------------------------------- --><sect1>When compiling programs with GTK+, I get compiler error messages about not being able to find <tt/"glibconfig.h"/.<p>The header file "glibconfig.h" was moved to the directory$exec_prefix/lib/glib/include/. $exec_prefix is thedirectory that was specified by giving the --exec-prefixflags to ./configure when compiling GTK+. It defaults to $prefix, (specified with --prefix), which in turn defaultsto /usr/local/.This was done because "glibconfig.h" includes architecturedependent information, and the rest of the include filesare put in $prefix/include, which can be shared between differentarchitectures. GTK+ includes a shell script, <tt/gtk-config/, thatmakes it easy to find out the correct include paths.The GTK+ tutorial includes an example of using <tt/gtk-config/for simple compilation from the command line. For informationabout more complicated configuration, see the filedocs/gtk-config.txt in the GTK+ distribution.If you are trying to compile an old program, you maybe able to work around the problem by configuring itwith a command line like: <tscreen><verb>CPPFLAGS="-I/usr/local/include/glib/include" ./configure</verb></tscreen>for Bourne-compatible shells like bash, or for csh variants:<tscreen><verb>setenv CPPFLAGS "-I/usr/local/include/glib/include" ./configure</verb></tscreen>(Substitute the appropriate value of $exec_prefix for /usr/local.)<!-- ----------------------------------------------------------------- --><sect1>When installing a GTK+ application, configure reports that it can't find GTK.<p>There are several common reasons for this:<itemize><item>You have an old version of GTK installed somewhere. RedHat 5.0, for example, installs an older copy of GTK that may not work with the latest applications. You should remove this old copy, but note that in the caseof RedHat 5.0 this will break the <tt/control-panel/ applications.<P><item><tt/gtk-config/ (or another component of GTK) isn't in your path, orthere is an old version on your system. Type:<verb>gtk-config --version</verb>to check for both of these. If it returns a value different from whatyou expect, then you have an old version of GTK on your system.<P><item>The ./configure script can't find the GTK libraries. As ./configurecompiles various test programs, it needs to be able to find the GTKlibraries. See the question above for help on this.</itemize><p>If none of the above help, then have a look in config.log, which isgenerated by ./configure as it runs. At the bottom will be the lastaction it took before failing. If it is a section of source code, copythe source code to a file and compile it with the line just above it inconfig.log. If the compilation is successful, try executing it.<!-- ***************************************************************** --><sect>Development of GTK+<!-- ***************************************************************** --><!-- ----------------------------------------------------------------- --><sect1>Whats this CVS thing that everyone keeps talking about, and how do I access it?<p>CVS is the Concurent Version System and is a very popular means of version control for software projects. It is designed to allow multiple authors to be able to simultanously operate on the same source tree. This source tree is centrally maintained, but each developer has alocal mirror of this repository that they make there changes to.The GTK+ developers use a CVS repository to store the master copy ofthe current development version of GTK+. As such, people wishing tocontribute patches to GTK+ should generate them against the CVS version.Normal people should use the packaged releases.The CVS toolset is available as RPM packages from the usual RedHat sites.The latest version is available at <htmlurl url="http://download.cyclic.com/pub/" name="&lt;http://download.cyclic.com/pub/&gt;">Anyone can download the latest CVS version of GTK+ by using anonymous accessusing the following steps:<itemize><item> In a bourne shell descendant (e.g. bash) type:<verb>CVSROOT=':pserver:anonymous@anoncvs.gnome.org:/cvs/gnome'export CVSROOT</verb><item>Next, the first time the source tree is checked out, a cvs login is needed. <verb>cvs login</verb>This will ask you for a password. There is no password for cvs.gimp.org, so just enter a carriage return. <item>To get the tree and place it in a subdir of your current workingdirectory, issue the command: <verb>cvs -z3 get gtk+</verb>Note that with the GTK+ 1.1 tree, glib has been moved to a separate CVSmodule, so if you don't have glib installed you will need to get thatas well:<verb>cvs -z3 get glib</verb></itemize><!-- ----------------------------------------------------------------- --><sect1>How can I contribute to GTK+?<p>It's simple. If something doesn't work like you think it should in a program,check the documentation to make sure you're not missing something. If it is atrue bug or missing feature, track it down in the GTK+ source, change it, and then generate a patch in the form of a 'context diff'. This can be doneusing a command such as <tt/diff -ru &lt;oldfile&gt; &lt;newfile&gt;/. Then upload the patchfile to:<verb>ftp://ftp.gtk.org/incoming</verb>along with a README file.  Make sure you follow the naming conventions or yourpatch will just be deleted! The filenames should be of this form:<verb>gtk-<username>-<date yymmdd-n>.patch.gzgtk-<username>-<date yymmdd-n>.patch.README</verb>The "n" in the date indicates a unique number (starting from 0)of patches you uploaded that day.  It should be 0, unless youupload more than one patch in the same day.Example:<verb>gtk-gale-982701-0.patch.gzgtk-gale-982701-0.patch.README</verb>Once you upload <em>anything</em>, send the README to ftp-admin@gtk.org<!-- ----------------------------------------------------------------- --><sect1>How do I know if my patch got applied, and if not, why not?<p>Uploaded patches will be moved to <tt>ftp://ftp.gtk.org/pub/gtk/patches</tt>where one of the GTK+ development team will pick them up. If applied, theywill be moved to <tt>/pub/gtk/patches/old</tt>.Patches that aren't applied, for whatever reason, are moved to <tt>/pub/gtk/patches/unapplied</tt> or <tt>/pub/gtk/patches/outdated</tt>.At this point you can ask on the <tt/gtk-list/ mailing list why your patchwasn't applied. There are many possible reasons why patches may not beapplied, ranging from it doesn't apply cleanly, to it isn't right. Don'tbe put off if your patch didn't make it first time round.<!-- ----------------------------------------------------------------- --><sect1>What is the policy on incorporating new widgets into the library?<p>This is up to the authors, so you will have to ask them once youare done with your widget. As a general guideline, widgets that are generally useful, work, and are not a disgrace to the widget set will gladly be included.<!-- ----------------------------------------------------------------- --><sect1>Is anyone working on bindings for languages other than C?<p>The GTK+ home page (<htmlurl url="http://www.gtk.org/" name="http://www.gtk.org/">) presents a list of GTK+ bindings.<itemize><item>There are several C++ wrappers for GTK+.  <itemize>    <item>the gtk-- package, which is a very small wrapper for GTK+.  You can find the home page at:  <htmlurl url="http://www.cs.tut.fi/~p150650/gtk/gtk--.html"  name="http://www.cs.tut.fi/~p150650/gtk/gtk--.html">.   The FTP site is   <htmlurl url="ftp://ftp.gtk.org/pub/gtk/gtk--"  name="ftp://ftp.gtk.org/pub/gtk/gtk--">.    <item>the VDK package, which was built as the base package of a GTK+  application Borland-like builder. The home page can be found at  <htmlurl url="www.guest.net/homepages/mmotta/VDKHome"   name="www.guest.net/homepages/mmotta/VDKHome">.  <item>The wxWindows/Gtk package, a free C++ library for cross-platform   GUI development. The home page of this package is  <htmlurl url="http://www.freiburg.linux.de/~wxxt/"  name="http://www.freiburg.linux.de/~wxxt/">.  </itemize> <p><item>There are three known Objective-c bindings currently in development:  <itemize>  <item>The <htmlurl url="http://www.gnome.org/" name="GNOME project's"> package  of choice is objgtk. Objgtk is based on the Object class and is maintained by  <htmlurl url="mailto:sopwith@cuc.edu" name="Elliot Lee">. Apparently, objgtk  is being accepted as the `standard' Objective-C binding for GTK+.  <item>If you are more inclined towards the   <htmlurl url="http://www.gnustep.org/" name="GNUstep project">,  you may want to check out GTKKit by   <htmlurl url="mailto:helge@mdlink.de" name="Helge He&szlig;">.  The intention is to setup a GTK+ binding using the FoundationKit.   GTKKit includes nicities like writing a XML-type template file to   construct a GTK+ interface.  <item>The GToolKit package, which can be found at  <htmlurl url="ftp://ftp.gtk.org/pub/gtk/objc-gtoolkit/"   name="ftp://ftp.gtk.org/pub/gtk/objc-gtoolkit/">. </itemize> <p>               <item>Perl bindings  <htmlurl url="ftp://ftp.gtk.org/pub/gtk/perl"  name="ftp://ftp.gtk.org/pub/gtk/perl"><P><item>Guile bindings. The home page is at  <htmlurl url="http://www.ping.de/sites/zagadka/guile-gtk"  name="http://www.ping.de/sites/zagadka/guile-gtk">.  By the way, Guile is the GNU Project's implemention of R4RS Scheme (the  standard). If you like Scheme, you may want to take a look at this.<p><item>David Monniaux reports:  <quote>I've started a gtk-O'Caml binding system.  The basics of the system, including callbacks, work fine.  The current development is in  <htmlurl url="http://www.ens-lyon.fr/~dmonniau/arcs"  name="http://www.ens-lyon.fr/~dmonniau/arcs">  </quote><item> Several python bindings have been done:<p>  <itemize>  <item>pygtk is at   <htmlurl url="http://www.daa.com.au/~james/pygtk"   name="http://www.daa.com.au/~james/pygtk"> and   <htmlurl url="ftp://ftp.gtk.org/pub/gtk/python"  name="ftp://ftp.gtk.org/pub/gtk/python">  <item>python-gtk is at  <htmlurl url="http://www.ucalgary.ca/~nascheme/python-gtk"   name="http://www.ucalgary.ca/~nascheme/python-gtk">  </itemize><p><item>There's are a couple of OpenGL/Mesa widgets available forGTK+. I suggest you start at  <htmlurl url="http://www.student.oulu.fi/~jlof/gtkglarea/index.html"   name="http://www.student.oulu.fi/~jlof/gtkglarea/index.html"><p><item>Last, there are a lot of other language bindings for languages such as   Eiffel, TOM, Pascal, Pike, etc.</itemize><!-- ***************************************************************** --><sect>Development with GTK+: the begining<!-- ***************************************************************** --><!-- ----------------------------------------------------------------- --><sect1>How do I get started?<p>So, after you have installed GTK+ there are a couple of things that canease you into developing applications with it. There is theGTK+ Tutorial <htmlurl url="http://www.gtk.org/tutorial/" name="&lt;http://www.gtk.org/tutorial/&gt;">, which is undergoing development. This will introduce you to writing applications using C.The Tutorial doesn't (yet) contain information on all of the widgetsthat are in GTK+. For example code on how to use the basics of all theGTK+ widgets you should look at the file gtk/testgtk.c (and associatedsource files) within the GTK+ distribution. Looking at these exmaples willgive you a good grounding on what the widgets can do.<!-- ----------------------------------------------------------------- --><sect1>I tried to compile a small <tt/Hello World/ of mine, but it failed. Any clue?<p>Since you are good at coding, we will not deal with compile time error here :).The classic command line to compile a GTK+ based program is<verb>gcc -o myprg [c files list] `gtk-config --cflags --libs`</verb>You should notice the backquote character which is used in this command line.A common mistake when you start a GTK+ based development is to use quote instead of backquotes. If you do so, the compiler will complain about an unknown file called 'gtk-config --cflags --libs'. The text inbackquotes is an instruction to your shell to substitute the output ofexecuting this text into the command line.The command line above ensure that:<itemize>  <item>the correct C compiler flags will be used to compile the program        (including the complete C header directory list)  <item>your program will be linked with the needed libraries.</itemize><sect1>What about using the <tt/make/ utility?<p>This is a sample makefile which compile a GTK+ based program:<tscreen><verb># basic GTK+ app makefileSOURCES = myprg.c foo.c bar.cOBJS    = ${SOURCES:.c=.o}CFLAGS  = `gtk-config --cflags`LDADD   = `gtk-config --libs`CC      = gccPACKAGE = myprgall : ${OBJS}        ${CC} -o ${PACKAGE} ${OBJS} ${LDADD}.c.o:        ${CC} ${CFLAGS} -c $<# end of file</verb></tscreen>For more information about the <tt/make/ utility, you should read either therelated man page or the relevant info file.<sect1>I use the backquote stuff in my makefiles, but my make process failed.<p>The backquote construction seems to not be accepted by some old <tt/make/utilities. If you use one of these, the make process will probably fail.In order to have the backquote syntax working again, you should use theGNU make utility (get it on the GNU ftp server at<htmlurl url="ftp://ftp.gnu.org/" name="ftp://ftp.gnu.org/">).<!-- ----------------------------------------------------------------- --><sect1>I want to add some configure stuff, how could I do this?<p>To use autoconf/automake, you must first install the relevant packages. Theseare:<itemize>  <item>the m4 preprocessor v1.4 or better

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -