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