Compile the GTK2.0 Program-general Linux technology-Linux programming and kernel information. The following is a detailed description. GTK is the c/c ++ language graphics library used to develop Gnome windows. I had a hard time on the Ubuntu machine and copied the online tutorial code to compile it on the local machine. Code File Name: t1.c. Follow the tutorial to compile with the following command:
Gcc t1.c 'pkg-config -- cflags -- libs gtk +-2.0'
Compilation result: gtk/gtk. h is not found.
Because my Ubuntu is a Gnome system, I thought that gtk + 2.0 development programs (header files and library files) should have been installed on the computer. Otherwise, if you develop a gtk + 2.0 program on Ubuntu, you need to install the corresponding header file and library. In the console window, enter sudo apt-get install libgtk2.0 *. All files required for gtk + 2.0 are downloaded and installed. Apply the compilation command again: gcc t1.c 'pkg-config -- cflags -- libs gtk +-2.0, compile and run.
Pkg-config is a program used to manage packages. On the console, enter the running result of pkg-config -- cflags -- libs gtk +-2.0:
It can be seen that the output text includes all the options required for gcc to compile gtk + 2.0 (header file directory and library file ).
Note that the gcc t1.c 'pkg-config -- cflags -- libs gtk +-2.0 ', the quotation marks on both sides of pkg-config -- cflags -- libs gtk +-2.0 are not real quotation marks, but the character on the leftmost side of the keyboard number. If a single quotation mark is used incorrectly, gcc cannot use the text generated by pkg-config -- cflags -- libs gtk +-2.0 as the compilation option.
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.