C Language Learning (1)-Environment configuration and C Language Learning Environment Configuration
In front of this article, I read a set of videos from instructor Yang. I wrote some notes while reading and writing. Thank you again.
1. misunderstandings to be avoided before learning C
Misunderstanding 1: C ++ is an upgraded version of C; C # Is an upgraded version of C ++.
Misunderstanding 2: C/C ++ is Visual C ++
Misunderstanding 3: MFC is a "Advanced Technology" required to learn C/C ++"
2. Description of development tools
2.1 Editor (Complier): compilation is a translation process from the source code to the target code (machine language) that can be directly executed by the computer. C language compilers include GCC, MSC ++ Complier
Extension: the execution of C # code is recompiled. It is the first time that C # compiler is compiled into an intermediate language (IL). The second compilation process occurs in, when an EXE file generated by C # code is executed, the real-time Compiler (JIT) is called to generate a computer-recognized machine language. |
2.2 Integrated Development Tool (IDE): IDE generally has the following features: keyword highlighted display, code automatically display, code formatting
3. gcc compiles the first C program
3.1GCC Introduction
3.2GCC usage
Step 1: Download the GCC file. Put the downloaded GCC file in a directory where there are no Chinese characters or spaces.
Write the following code, name it t1.c, and save it to the abc folder on the edisk.
# Include <stdio. h> int main () {printf ("hello"); return 0 ;}
Note: The Code saving format must be ANSI. Otherwise, garbled characters may appear in Chinese.
Step 2: Open cmd, enter the folder where t1.c is located, run the compilation process, and run the exe
$ (FileName)-w-o Records (filenamenoext0000.exe-IF: \ GTK \ include \ GTK-3.0-IF: \ GTK \ include \ cairo-IF: \ GTK \ include \ gdk-IF: \ GTK \ include \ glib-2.0-IF: \ GTK \ lib \ glib-2.0 \ include-IF: \ GTK \ include \ pango-1.0-IF: \ GTK \ include \ atk-1.0-IF: \ GTK \ include \ gdk-pixbuf-2.0-LF: \ GTK \ lib-lgtk-win32-3.0-lgobject-2.0-lglib-2.0-lgdk-win32-3.0-lgdk_pixbuf-2.0-lcairo-mwindows
Enter the following code in EditPlus:
# Include <stdio. h> # include <gtk/gtk. h> // introduce the GTK file int main (int argc, char * argv []) {// initialize the GTK environment. If this parameter is not specified, the error gtk_init (NULL, NULL) is returned ); // create a top-level window and return the window pointer GtkWidget * window = gtk_window_new (GTK_WINDOW_TOPLEVEL); // set the Form title gtk_window_set_title (window, "hello "); // after the setting window is closed, the program exits. Otherwise, the process is still running. At this time, gcc g_signal_connect (window, "destroy", gtk_main_quit, NULL) cannot be compiled ); //// display the window gtk_widget_show (window); // start the message loop. If no program is added, it will flash back. Generally, no code is written after gtk_main (); return 0 ;}
After running
I wrote it here on the first day. I will modify it later. Suddenly I found it very difficult to write out what I know.