自己动手用cl.exe和link.exe编译和连接程序

1. 设置环境变量path:

例如:C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools

2. cmd,定位到源代码目录,运行vsvars32.bat 

3. cl.exe /c test.c 

#include <windows.h> 
int APIENTRY wWinMain(_In_ HINSTANCE hInstance, 
        _In_opt_ HINSTANCE hPrevInstance, 
        _In_ LPWSTR    lpCmdLine, 
        _In_ int       nCmdShow) 
{ 
        MessageBox(NULL, "Hello Win32", "sdk", MB_ABORTRETRYIGNORE | MB_ICONERROR); 
        return 0; 
} 
4. link.exe test.obj user32.lib


参考:

https://blog.csdn.net/hyman_c/article/details/53141662

https://blog.csdn.net/laogaoav/article/details/9060089

https://msdn.microsoft.com/zh-cn/library/19z1t1wy.aspx

猜你喜欢

转载自blog.csdn.net/g0ose/article/details/80352733