DEV-CPPMINGW32 Environment Introduction (1)

zhaozj2021-02-16  115

DEV-CPP / MINGW32 Environment Introduction (1)

This article is reproduced from: http://blog.9cbs.net/visioncat/archive/2004/08/03/59903.aspx

Foreword

It is now increasingly concerned about programming problems and business companies' concerns about copyright issues. So I recommend an IDE similar to VC. The compiler used by this IDE is the Win32 version of the GCC MINGW32. The IDE itself is also the product of the GPL protocol. So, whether it is commercial users, or individual users can use her without having to use pirated software to hang. In addition, since MINGW32 is a GCC Win32 version. Therefore, it is also possible to learn how UNIX and class UNIX can be found. Moreover, the support of MINGW32 on Win32 functions is also very good. Hope, our MingW32 trip can bring you happiness.

Introduction

I don't want to explain more about DEV-CPP. Because the following will be specifically introduced and explained. I just want to introduce the content of GCC. Because the MINGW32 used by DEV-CPP is a GCC compiler. Therefore, understanding of GCC helps to use DEV-CPP.

GCC.exe This is a C language compiler, responsible for compiling C language. This may know. However, here I have to explain it to you first. GCC is just a C language compiler. C code cannot be identified. Therefore, the previous GCC can write C is an error. Because we usually say GCC is not gcc.exe but a set of gcc. Among them, it includes G for C languages ​​that can be compiled. EXE

If you don't sure this GCC version, you can use the following command to view.

GCC -V

About compilation, GCC can be compiled by the command.

GCC Source.c -o binary

The above command is to let the GCC are compiled into executable code directly from the .C code. It can also be the case.

gcc -c Source.c -o code.ogcc code.o -o binary

This generates a set of binary code, and then generates an executable program through the binary code.

G . EXE has just been said, this is a program for compiling C code. The basic usage is the same as GCC. So here no longer introduce it. Just let you know, this program is compiled C code.

gdb.exe is used to debug programs. It is very powerful. You can debug C, C and other languages. It is said that Java programs can also be debugged. But I didn't tried it. Programs compiled with GCC / G . The -g parameter is added when compiling. GDB can debug. It is a bit like the debug of VC.

Make.exe This is a very useful program that can be used to publish programs and code groups compiling complex relationships. In fact, it is a bit like a prompt version of the installer. Different, the installer is a binary execution code, and it is a text document. Makefile file is executed. The file is a text document that contains the program's compilation rules. If you want to use a prompt to call, you can use the following method.

Make -f makefile

The Make will then compile and install according to the compilation relationship provided by Makefile. Below is a parakefile content. Please note that the gap at the beginning is Tab.

Release: main.o gcc main.o -o mainmain.o: main.c gcc -c main.c -o main.o

Then, you can execute by command Make -f Makefile Release. Make will determine whether to recompile to Main.o according to the creation date of the file. That is, Make can know which files have been modified and the modified file is recompiled. Connect to the program. This helps developers to save time and effort on development cycles. Ok, I hope that the introduction above can make you satisfied. Here, I only introduce some of the main procedures, telling other things. Let's introduce the files generated by GCC.

* .o is actually the * .objlib * .a generated by VC is the * .lib static link library used in the VC. Just, each library must start with the lib. When you call, you can use the content of *. * .so although it is very small in Win32, it is almost unused but still introduces it. This is the * .dll dynamic connection library in Win32. However, DLL has been supported in MING32.

Ok, about GCC introduction is here. Below we start entering the topic.

Chapter 1 Install DEV-CPP

Here, I don't introduce how MingW32 is installed. MINGW32 has been included in DEV-CPP. If you want to know how MingW32 is installed, you can view other relevant information. It does not explain here. First, we must download a DEV-CPP installer. The official website of DEV-CPP is http://www.bloodshed.net. DEV-CPP page is http://www.bloodshed.net/dev/devcpp.html The latest version should be DEV-CPP 4.9.9.0 Its download address is http://umn.dl.SourceForge.Net/sourceForge/ DEV-CPP / DEVCPP4990SETUP.EXE. This downloaded file contains all content. After getting the installer, we will install it. No matter what, I think, install this small problem, I don't want to introduce it again. After all, we are all programmers, if, even the installation will not be .... However, if there is any problem in the installation, you can make it. I will try my best to solve it. After you double-click the installer, you will be installed in a usual installation. It is recommended to install it according to the default. Of course, if you install it, you will. After the first installation, the program prompts your interface settings. If you like English, choose ENGLISH. If you like Chinese, choose Chinese. Be careful not to choose Chinese (TW) unless you have a traditional Chinese. And like traditional Chinese. Then the icon settings. Recommend you to use New Look. If you like other options. There is also whether it is using the XP style. These are just casual. It will be introduced here, here. I have already introduced the installation of DEV-CPP, if it is smooth. After you run, you will see the following interface.

Next, let's introduce the settings for DEV-CPP in Windows. Since there are many things in GCC to operate on the prompt, especially for DEV-CPP installations, compile some of the toolkit. So, we add MINGW32 to the system command to help call later. The method is simple, right-click my computer. Then choose color properties. Use the Advanced tab. Click the Environment Variable button. Click on the PATH item and click the Edit button. Then add the path to the bin directory in the DEVCPP installation directory to the back of this option value. Attention, use; separation. Determine the command prompt. Enter GCC -V. Everything is fine. Now you can compile programs as in the Win32 environment as in the Linux environment.

At this point, your DEV-CPP environment has been done. Below we will introduce how to make a program.

Chapter 2 New Projects and Compilation

This chapter we have to train practical training. This section describes how to make projects new and compile them under DEV-CPP. I believe that you will slowly like this compilation environment. Click on the file menu to select New, click Engine. Select the type of program you need in the dialog that appears. As shown below. Where Windows Application is the Win32 graphical interface. Console Application is a Win32 console program. Static library is a static connection library for Win32. DLL is a dynamic library of Win32. Empty Project is a more project type to create a new project type. The following content is the language that is selected, such as the C language or C language. There is also the project name. This name will be the name of the executable program after the program compile. Here, in order to make it easy, we have created a new console application project. As for the language used, you will be casually. I will use the C language here. After clicking OK, prompt the path saved path, it is recommended that you choose another path not to use the default path, because the default path is the installation directory. If you put there, it will be confusing. In other directories, create a folder (of course, no new construction can also be, just so easy management) save the project there. Then, click the Save button (this button is a disk, and the same in Windows) or select Save or Ctrl S from the File menu. These can be. In this way, DEV will prompt you for the save directory of the default file in the project. Usually named main. *. Select a path and save it. (Suggestions and project files are saved)

Let's compile the program. Click on the toolbar, the second line, the first colored button. Compiled. At this time, a compilation window will appear to display the progress of the compilation. You can set it with the environment option. After the compilation is complete, click the second white button to run the program. Is it very convenient? I also think so.

Next, I will introduce the role of the files within the project catalog.

Main.c program C language source code. Main.o main.c binary code. Makefile.win is like what I said above, this is the project's makefile file. Use the make command to compile the program. * .dev * content is determined by the name of your project. This is a project file, which is used to record your settings for the project. The role of the file within the file is not introduced. * .exe you generated executable.

Finally, I will introduce how to compile the generator without IDE. First enter your directory where your project is located. Then use the following command.

Make -f makefile.win all

You can compile it. Of course, it can also be implemented directly by compiling source code. Specific methods, I have already introduced it. It will not be repeated here again.

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

New Post(0)