自己動手用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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章