Development environment (MINGW, GTK2.0, SDL, DEV-C ++)

xiaoxiao2021-03-06  113

1) First install MINGW (www.mingw.org sourceforge.net), MINGW, MINIMALIST GNU for Windows. It is a collection of some header files and port libraries that allow people to use GCC (GNU Compiler C) without a third-party dynamic link library. At the basic layer, MINGW is a set of included files and port libraries that allow the program to allow console mode to use Microsoft's standard C running time library (MSVCRT.DLL), which is valid on all NT OS, in all Windows 95 released Windows OS is valid, use basic runtime, you can use the GCC write console mode to meet the US Standardization Organization (ANSI) program, you can use Microsoft's C run time expansion. This feature is not available in Windows32 API. The next component is a W32API package, which is a set of files and port libraries that can use the Windows32 API. Combined with the basic runtime, there is a sufficient right to use both CRT (C runtime) using Windows32 API functions.

SourceForge.net downloads MINGW's Runtime and GCC. GCC has core, g , ada, etc., see you need to download.

After mingw download, decompress your favorite path. For example, D: / Tools / MingW, then add D: / Tools / MingW / BIN to the system Path.

Differently extract the downloaded GCC-CORE to D: / Tools / MingW, so there is gcc.exe, etc. below the bin directory.

Now you have a Gun's compilation environment. You can go to the command line, run gcc -v and get the following result in my machine.

Reading SPECS from D: / Tools / Mingw / Bin / 132 / 3.4.1 / SpecSconfigured with: ../gcc/configure --with-gcc --with-gnu-ld --with- GNU-as --host = mingw32 --target = mingw32 --prefix = / mingw --enable-threads --disable-nls --enable-languages ​​= C, C , F77, Ada, Objc, Java --disable- Win32-registry --disable-shared --enable-sjlj-exceptions --enable-libgcj -disable-java-awt --without-x-able-java-gc = boehm --disable-libgcj-debug Enable-interpreter --enable-hash-synchronization --enable-libstdcxx-debugthread model: Win32GCC Version 3.4.1 (Mingw Special)

The last line, indicating that the current GCC is specifically for mingw.

You can also install Cygwin, but this compiled code is to follow GPL.Cygwin is a product of Cygwin (http://cygwin.com/), which provides a UNIX environment under the Windows operating system, which can help program developers Applications are ported from UNIX / Linux to the Windows platform, which is a powerful toolset.

2) Ok, now you can write a C Hello World program with Notepad, then use the command line to compile it.

However, although it is very cool, the efficiency is not cool. Go to download a free to get the IDE to play, you can try a DEV-C , and there is downloaded above, this is written with Delphi / Kylix .GPL. Download installation can be used. 3) OK. Now let's try the GUI's thing, try to try with GTK, go http://www.gimp.org/~tml/gimp/win32//downloads. HTML Download Glib, Libiconv GetText-Runtime, GTK , ATK, PANGO, AND FREETYPE2. Note the DEV version. Very trouble, so much, then unzip it below the Mingw installation directory, there are many things below in including and Lib. Oh, go Download a pkg-config.exe. Then the command line runs this command pkg-config --cflags gtk -2.0 I am doing this.

-Id: /Tools/mingw/include/gtk-2.0 -id: /Tools/mingw/lib/gtk-2.0/include -id: /Tools/Mingw/include/atk-1.0 -id: / Tools / MingW / Include /PANGO-1.0 -ID: /Tools/mingw/include/glib-2.0 -id: /Tools/mingw/lib/glib-2.0/include

Get this pile of things in the DEV-C Include settings.

Run PKG-Config --Libs GTK -2.0, and then get the results in the DEV-C settings.

Pay attention to compilation Add -MMS-bitfields link to -MWindows

Write a simple GTK program, compile, see, huh, you should run.

4) Let's play SDL again, go to http://www.libsdl.org/ Download the manufacture libraries: MINGW version. Unzip to the mingw directory below

Of course, you can also get another directory (MingW is now like a trash can). DEV-C sets the path to include and libs.

Libs uses this -lsdl last coupled to -mWindows must pay attention to the order, otherwise Complaining About the missing symbol WinMain @ 16 will appear.

Then compile SDL's example to play. :)

Write here first.

Http://www.linux process.net/forum/gshowflat.php?cat=98623&page=5&view=collapsed&sb=5&o=llapart=all&vc=1

Http://www.huihoo.com/gnu/gtk2-tut/book1.html

转载请注明原文地址:https://www.9cbs.com/read-124693.html

New Post(0)