Ubuntu 12.04 running the C-language GTK program in Eclipse IDE for C + + developers

Source: Internet
Author: User
Tags gtk

Hahaha ... Finally fix the GTK program compile and run, tangled up the problem of nearly one months finally resolved, happy! In the last one months, Baidu, blog, Baidu know questions, csdn questions ... Often send private messages, comments blog Trouble Daniel, such as sunny2038, ethereal wind yang, Sun1956 ... Thank you for all the people who helped me!
In particular, thanks to Csdn's sunny2038, his blog post "windows and Ubuntu11.10 configuring C and GTK in Eclipse" and enthusiastic replies gave me a lot of help!
Neo E. Cai's blog post "installation, compilation and testing of GTK under Ubuntu" is of great importance to me, and here I would like to express my special thanks!

Take a look at the process of running the C-language GTK program in Eclipse IDE for C + + developers under Ubuntu 12.04 and hopefully help people with similar problems.


installation, configuration process:
1. Download the Ubuntu-12.04-desktop-i386.iso and install it as VM virtual machine.
2, download jdk-7u4-linux-i586.gz and extract to/USR/LIB/JVM.
3, download eclipse-cpp-luna-r-linux-gtk.tar.gz and extract to/usr/lib.
4. Install GTK 2.24.10 in the process of installing, compiling, and testing Ubuntu under GTK.
5. Configure eclipse with Windows and Ubuntu11.10 configuring C and GTK in Eclipse.


The main solution:
1, can not find gtk/gtk.h solution: Select GTK Project, right click Choose properties-->c/c++ BUILD-->SETTINGS-->GCC C compiler--> Includes, joins/usr/include/gtk-2.0 and/usr/include/glib-2.0.
2, can not find the Glibconfig.h and other header file solution (information similar to:/usr/include/glib-2.0/glib/gtypes.h:34:24:fatal error: Glibconfig.h:no such file or directory): Find your directory with locate Glibconfig.h in the terminal and add it individually in Attention point 1 (you should be able to set environment variables, but as a novice Linux i Unfamiliar), the main directory is as follows:

/usr/lib/i386-linux-gnu/glib-2.0/include
/usr/include/cairo
/usr/include /pango-1.0
/usr/lib/i386-linux-gnu/gtk-2.0/include
/usr/include/gdk-pixbuf-2.0
/usr/include/atk-1.0
3, appears ' undefined reference to ' gtk_init ' etc. error workaround

(1) Select the GTK project, right-click the PROPERTIES-->SETTINGS-->GCC C Linker, and in command line pattern, move ${flags}
To the end, that is: ${command} ${output_flag} ${output_prefix} ${output} ${inputs} ${flags}
or move ${inputs} to the front of ${flags} , i.e.: ${command} ${inputs} ${flags} ${output_flag} ${output_prefix} ${output}
(2) Select the GTK project, right click on Choose PROPERTIES-->SETTINGS-->GCC C compiler-->miscellaneous add ' pkg-config--cflags gtk+-2.0 ', become -c-fmessage-length=0 ' pkg-config--cflags gtk+-2.0 '. (One of my tragedies: deleted-c-fmessage-length=0)
(3) Select the GTK project, right click on Choose PROPERTIES-->SETTINGS-->GCC C linker-->miscellaneous add:' pkg-config--libs gtk+-2.0 '


Pay special attention to cflags,libs before it is two---One of my tragedies: direct from windows and Ubuntu11.10 to configure C and GTK in eclipse Copy, only one--).


Ubuntu 12.04 running the C-language GTK program in Eclipse IDE for C + + developers

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.