Today, IDE is full of sky, and features are getting stronger and stronger. For programmers, this is indeed a good thing, and it is self-evident that it can improve work efficiency.
But for beginners, using ide directly may not be a good thing because ide has done a lot for you, but you don't understand it. Lead Hou Jie's
In a word: "do not build a high station in the sand float ". Next let's take a look at how to compile and link the program in the command line. You know, this is ide
.
On Windows, nmake is used for command line compilation. The usage of nmake is described in detail in msdn.
For nmake beginners, it is not that complicated.
First, to use nmake, you must compile a MAKEFILE file for your program to describe if you compile and link your program. A common
The MAKEFILE file is as follows:
! Include <win32.mak>
All = hello.exe
Objs = Hello. OBJ draw. OBJ
. C. OBJ:
$ (CC) $ (cflags) $ (cvars) $ *. c
Hello.exe: $ (objs)
$ (Link) $ (guiflags)-out: hello.exe $ (guilibs) $ (objs)
Clean:
Del *. OBJ
The first line! Include <win32.mak> introduces some common macro definitions, such as $ (CC) $ (link. It is easy to use.
The makefile format is: What you want to generate: What you need to generate the previous one (haha, it is quite "plain ). For example
Statement:
Hello.exe: $ (objs)
To generate hello.exe, you need $ (objs). What is $ (objs? This introduces the second definition method in makefile:
Name = indicates the items to be represented, such as objs = Hello. OBJ, which indicates that objs represents hello. OBJ and draw. obj.
To reference objs, you must use the $ (objs) method so that nmake can recognize it.
The following describes the macro definition introduced by win32.mak. (To be continued)