How to write WIN32 programs using only Nmake+cl+link

Source: Internet
Author: User

The point is
1. Include <Windows.h> and other related header files
2. At the very least, add KERNEL32.LIB USER32 to the link directive. LIB GDI32. Lib (no need to develop its path because NMAKE, CL and link are all from VS, these 3 Lib files are all configured by default), and these three lib files contain the information required for other DLLs. Of course, not only these three, but these three are the most basic, if you need other, it is recommended to open vs Create a WIN32 project, and then through Project>properties>linker>input (or Command Line) To see what other LIB files are needed

Additional notes:

Excerpt from the demo below makefile
Libraries of WINAPI You can create a WIN32 application in VS and inspect the project ' s linker options.
Select project>properties>linker>input (or Command line) so you can see all LIB files needed by a WIN32 Applicati N.
These 3 LIB files contain names and reference information of the Dynamic-link libraries to being bound to the generated EXE F Ile. "


Excerpt from Programming Windows 5th Edition, by Charles Petzold
As normal, during the compile stage, the compiler generates an. OBJ (object) file from the C source code file.
During the link stage, the linker combines the. OBJ file with. LIB (library) files to create the. EXE (executable) file.
You can see a list of these libraries files by selecting Settings from the Project tab and clicking the Link tab. In
particular, you ' ll notice KERNEL32. LIB, USER32. LIB, and GDI32. Lib. These is "import libraries" for the Three
Major Windows subsystems. They contain the Dynamic-link library names and reference information that's bound
Into the. EXE file. Windows uses this information to resolve calls from the program to functions in the
KERNEL32. DLL, USER32. DLL, and GDI32. DLL Dynamic-link Libraries "

This is a Hello World WIN32 DEMO, click to download

How to write WIN32 programs with Nmake+cl+link only

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.