NMAKE entry (1)

xiaoxiao2021-03-06  42

Today, the IDE has fly all over, and the function is getting stronger. For programmers, this is indeed a good thing, and it is self-evident to improve work efficiency. But for beginners, it is not a good thing to use IDE directly because Ide has done a lot of things for you, but you don't know. One sentence of the attraction: "Do not build a high platform". Let's take a look at how to compile and link in the command line. You know, this is one of the main features of IDE.

Under the Windows platform, the compilation of the command line is mainly NMAKE, and there is a detailed description of NMAKE, MSDN is a detailed description, but this article is for NMAKE beginners, not so complicated.

First, use nmake, you must write a Makefile file for your program to describe if you compile and link your program. A common Makefile file is as follows:

Include

All = hello.exe

Objs = hello.obj draw.obj

. C.Obj: $ (CC) $ (CFLAGS) $ (CVARS) $ *. c

Hello.exe: $ (LINK) $ (Guiflags) -out: Hello.exe $ (Guilibs) $ (OBJS)

Clean: Del * .obj

First line! Include will introduce some common macro definitions, such as $ (cc) $ (link), etc. It is mainly convenient to use. The format of the makefile is: something to generate: generates front things need something (huh,, write more "popular"). For example, the following statement: Hello.exe: $ (objs) means that generating Hello.exe requires $ (OBJS), and what is the $ (OBJS)? This leads out the second definition method in makefile: Name = something to represent, such as objs = hello.obj, indicating that objs represents hello.obj and draw.obj, and later references Objs, must use $ ( Objs) This way, so NMAKE can identify.

Here we focus on the macro definition introduced by Win32.mak. (to be continued)

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

New Post(0)