Do it yourself with cl.exe and link.exe to compile and link the program

1. Set the environment variable path:

For example: C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools

2. cmd, locate the source code directory, run 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


reference:

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

Intelligent Recommendation

Do it yourself and compile OpenJDK

Personal Technology Blog: www.zhenganwen.top Author environment 64bit / Windows10 / i5-7200U / 4 core CPU, on the virtual machineCentos7(can be connected to the external network) compiledOpenJDK7u75 R...

Use cl.exe to compile C++ program under windows console

tool cl.exe is a 32-bit tool that controls the Microsoft C and C++ compiler and linker. The compiler compiles .cpp to generate an intermediate code object file (.obj). The linker links the object file...

Use CL.EXE to compile the C/C ++ program and execute it in the command line

Table of contents illustrate Attach illustrate Cl.exe is Microsoft C/C ++ compiler. My VC6.0 installation directory is: D: \ Program Files (X86) \ Microsoft Visual Studio \ Common \ MSDEV98 \ Bin The ...

Compile and link the program

"Programmer's self-cultivation" study notes. Those who want to know more can read this book (Electronic Industry Press). Under Linux, when using GCC to compile Hello World, only the simplest...

Compile, link a small program

Source Output "hello world", and then exit; vim a.c Programs "read backwards"; is nomain entry function, print and exit function calls, the former is output hello world (write), wh...

More Recommendation

C ++ program, compile, link

C ++ program, compile, link .h file, .lib file with .dll file .h header file is necessary, lib is required when the link is linked, and the DLL is required. The H file function is: Declaration functio...

Use VS tools cl.exe, linker.exe to compile and connect windows API program and MFC program

Use tools such as cl.exe, linker.exe to compile the program learning target Compile and link Windows API program Compile and link MFC program to sum up references learning target Use VS's command line...

Rust compile error linker `link.exe` NOT FOUND

solve: Download and install VisualcppBuildTools_full.exe download link: https://download.microsoft.com/download/5/f/7/5f7acaeb-8363-451f-9425-68a90f98b238/visualcppbuildtools_full.exe...

compile c cpp with cl.exe in vim

1 touch a clc.bat 2 touch a clcpp.bat 3 add clc.bat clcpp.bat to env 4 _vimrc...

Compile the linker with cl.exe and linker.exe of vs2017

table of Contents Environment variable settings Run the hello world program Run Windows API program Compile link run Run MFC program Compile link run to sum up: Environment variable settings Due to th...

Copyright  DMCA © 2018-2026 - All Rights Reserved - www.programmersought.com  User Notice

Top