如何只利用NMAKE+CL+LINK写WIN32程序
2015-03-31 20:07
141 查看
关键是
1.包含<Windows.h>及其他的相关头文件
2.在LINK指令中最起码要加上KERNEL32.LIB USER32.LIB GDI32.LIB(不需要制定其路径,因为NMAKE, CL和LINK都来自VS,这3个LIB文件都是默认配置好的),这三个LIB文件包含了所需的其他DLL的信息。当然,不止这三个,但这三个是最基本的,如果还需要其他的,建议可以打开VS创建一个WIN32 project,然后通过Project>Properties>Linker>Input (or Command line)查看还需要哪些其他的LIB文件
补充说明:
摘自下面demo的Makefile
"For more 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 applicatin.
These 3 LIB files contain names and reference information of the dynamic-link libraries to be bound to the generated exe file."
摘自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 library 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 are "import libraries" for the three
major Windows subsystems. They contain the dynamic-link library names and reference information that is 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"
这是一个HELLO WORLD的WIN32 DEMO,点击下载
1.包含<Windows.h>及其他的相关头文件
2.在LINK指令中最起码要加上KERNEL32.LIB USER32.LIB GDI32.LIB(不需要制定其路径,因为NMAKE, CL和LINK都来自VS,这3个LIB文件都是默认配置好的),这三个LIB文件包含了所需的其他DLL的信息。当然,不止这三个,但这三个是最基本的,如果还需要其他的,建议可以打开VS创建一个WIN32 project,然后通过Project>Properties>Linker>Input (or Command line)查看还需要哪些其他的LIB文件
补充说明:
摘自下面demo的Makefile
"For more 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 applicatin.
These 3 LIB files contain names and reference information of the dynamic-link libraries to be bound to the generated exe file."
摘自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 library 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 are "import libraries" for the three
major Windows subsystems. They contain the dynamic-link library names and reference information that is 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"
这是一个HELLO WORLD的WIN32 DEMO,点击下载
相关文章推荐
- Win32 SDK基础(2)—— 自己动手用cl.exe和link.exe编译和连接程序
- 用UDP实现可靠文件传输,如何利用UDX创建一个简单的WIN32程序
- 用UDP实现可靠文件传输,如何利用UDX创建一个简单的WIN32程序
- 学了C语言,如何利用CURL写一个下载程序?—用nmake编译CURL并安装
- Visual C# 2005 - 如何利用程序代码产生多层次绘图效果
- Visual C# 2005 - 如何利用程序代码动态存取设定文件
- Visual C# 2005 - 如何利用程序代码产生多变化字体之笔刷字
- 如何利用C#编写在Windows右下角增加图标的程序?
- ASP小偷程序如何利用XMLHTTP实现表单的提交
- ◎Vbs脚本编程简明教程之四—如何利用Vbs运行外部程序?
- 如何利用VB编写NT服务程序
- 如何利用C#开发Windows Mobile5.0程序
- 利用vc 6.0目录下的cl.exe直接编译程序的方法
- 如何改变Win32 Console 程序显示颜色?
- 如何改变Win32 Console 程序显示颜色?
- Visual C# 2005 - 如何利用程序代码产生多层次绘图效果
- 多线程WIN32程序如何检查死锁(三)-使用Petri网络来表示多线程应用程序
- 如何寻找WEB程序漏洞,及如何利用和防范
- ASP小偷程序如何利用XMLHTTP实现表单的提交以及cookies或session的发送
- 如何改变Win32 Console 程序显示颜色