Linux GUI Programming --- Hello World

2010-03-17  来源:本站原创  分类:OS  人气:176 

K & R C, APUE after a bar in the GUI to point

#include <gtk-2.0/gtk/gtk.h>
int main(int argc, char *argv[])
{
        GtkWidget *window;
        /*  Set a default value such as vision and color map   */
        gtk_init (&argc, &argv);
        /*  Create a new window
         * GTK_WINDOW_TOPLEVEL
         *  Indicates that the window using the window manager  " Specifies the location of the State of the location and layout
         *  No child windows of the window, the default setting is  200 * 200 The pixel size
         * */
        window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
        /*  A new window appears   */
        gtk_widget_show (window);
        /*  Enter the Gtk main processing loop  , Wait for X event   */
        gtk_main ();
        return (0);
}

Sure you have the GTK library

[[email protected] ~]$ ls /usr/include/gtk-2.0/gtk/gtk.h
/usr/include/gtk-2.0/gtk/gtk.h

Compile

gcc base.c -o base `pkg-config --cflags --libs gtk+-2.0`

The simplest one window, close the deal have not, ctrl + c to end of it

相关文章
  • Linux GUI Programming --- Hello World 2010-03-17

    K & R C, APUE after a bar in the GUI to point #include <gtk-2.0/gtk/gtk.h> int main(int argc, char *argv[]) { GtkWidget *window; /* Set a default value such as vision and color map */ gtk_init (&argc, &argv); /* Create a new window * GTK

  • Linux Shell Programming Training [Reserved] 2010-06-24

    As the project needs, the recent need to write some shell scripts, suffer no basis for a number of documents reproduced in the first study are: On the variables, also need to know a few Linux commands associated. env zone used to display the user env

  • Linux System Programming Study Notes (1) File I / O 2010-04-23

    File I / O 1, open the file int open(const char *name, int flags); int open(const char *name,int flags, mode_t mode); flags: Must be O_RDONLY, O_WRONLY, ORDWR add one other option: O_APPEND: append mode O_ASYNC: Terminal and the socket file is availa

  • Linux System Programming Study Notes (2) C standard I / O Library 2010-04-23

    Standard I / O Buffered I / O: Buffered I / O can reduce the number of system calls and improve performance. Each time an integer multiple of a block can improve efficiency. 1, Standard I / O: C language standard IO library stdio, provides a cross-pl

  • Linux System Programming Study Notes (3) Advanced File I / O 2010-04-24

    Advanced File I / O 1, Linux provides high-level I / O operations: 1) Scatter / gatter I / O: a single system call can write files from multiple buffer or read more buffer. 2) Epoll: is the poll () and select () the improved version. 3) Memory-mapped

  • Linux System Programming Study Notes (4) file and directory management 2010-04-25

    File and directory management: 1, access to file metadata of the Stat family: #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> int lstat(const char * restrict path, struct stat * restrict buf); int stat(const char *restri

  • Linux System Programming Study Notes (5) process management 1 2010-04-30

    Process management (1) And file the same basic process is the abstract one of the Unix system. 1, the process ID: Each process has a unique label, the process ID. Although the process ID is unique, but the process of termination, id will be reused by

  • Linux Systems Programming Study Notes (6) process management 2 2010-04-30

    Process Management 2 1, users and groups: Process and the associated users and groups, user id and group id are the C language, uid_t and gid_t types said. Digital representation and the mapping relationship between the readable string user space thr

  • Linux System Programming Study Notes (6) process management 2 2010-04-30

    Process Management 2 1, users and groups: Process and the associated users and groups, user id and group id are the C language, uid_t and gid_t types said. Digital representation and the mapping relationship between the readable string user space thr

  • Linux System Programming Study Notes (9) signal management 2 2010-05-03

    Signal 2: 1, the signal set: Signal set and its operation that we often encounter, such as setting some of the process to block the signal, process the signal pending collection. The following are common signal operations: #include <signal.h> int si

  • linux shell programming Summary (Abstract) 2010-05-10

    Seldom written, easy to forget. Extract notes. linux shell programming summary http://blog.csdn.net/ltbook This week learning the unix / linux shell programming, refer to the "LINUX and UNIX Shell Programming Guide", David Tansley forward; Xu Ya

  • Introduction to Linux network programming - switch 2010-06-01

    (1) Linux network programming - the network of knowledge Introduction Client and server <br /> network procedures and general procedures have one of the biggest difference is that network program is composed of two parts - client and server side. Th

  • Learn linux / unix programming methodology, learning the four steps in Linux 2010-08-05

    Suppose you are a computer technical education, computer science courses such as basic data structures, operating systems, architecture, compiler theory, computer networks, like me you are completely repair can be divided into four stages from low to

  • Linux, C programming language to learn multi-threading 2010-09-17

    Linux, C programming language to learn a multi-threaded, first of all, a simple look at multi-threading, from the familiar fork (), pthread clues in the management points out, and then write a simple look to increase confidence. 1, Linux systems foll

  • Learn linux / unix programming recommendations 2010-04-16

    First of all, learn first editor, vim, emacs what do. Then learn make file documents, as long as that point on the line, so you are ready to compile proceedings. Then take a look at "C Programming Language" K & R, so it basically can be prog

  • Linux System Programming Study Notes (11) daemon 2010-05-07

    Daemon: Daemon is a relatively long survival time of a process. They are often held in the system from the start when, only when the system is shut down termination. Because they do not control the terminal, So they are running in the background. The

  • Ruby GUI Programming 2010-06-08

    Ruby bindings more mature GUI libraries have FXRuby, Ruby-GNOME2, RubyCocoa, wxRuby. FXRuby wxRuby is an open source ruby interface development package. It provides the wxWidgets cross-platform C + + interface framework for Ruby support. wxWidgets is

  • Introduction to Linux Shell Programming 2011-01-23

    Shell Programming Abstract: This article describes how to write with a large number of instances a shell script. Why do you want to shell programming in the Linux system, although there are a variety of graphical interface tools, but the shell is sti

  • Introduction to Linux shell programming [turn] 2011-04-25

    Shell itself is a program written in C language, it is the bridge between users of Linux. Shell is a command language is a programming language. As a command language, which interactively interpretation and implementation of user-entered commands; as

  • Linux Shell Programming Study Notes 2011-06-28

    In fact, as the command language to interpret and execute interactive commands entered by the user is only one aspect of Shell functions, Shell can also be used for programming, it provides a means to define the variables and parameters as well as a