Nmake (1)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.