COMPILE: what does compile actually mean. Most .exe files are written in programming languages that are “compiled”. This term has a special meaning for computer people: it means translating the program from the form that a human can read and write into a form whereby the computer’s processor can run it. This is not, in general, a reversible process. Many kinds of information that humans find important or vital in working with a program’s source code are discarded in the process of compilation. This includes all the names for parts of the program and for items of data within it,… Read more »
if you only want to generate the object file, then put flag -c after cl:
cl -c
if you just want to directly generate the .exe file, then do not add the -c
to generate debug info into object file, use flag /Zi
debug information (i.e. it was compiled with the -g flag)
COMPILE: what does compile actually mean. Most .exe files are written in programming languages that are “compiled”. This term has a special meaning for computer people: it means translating the program from the form that a human can read and write into a form whereby the computer’s processor can run it. This is not, in general, a reversible process. Many kinds of information that humans find important or vital in working with a program’s source code are discarded in the process of compilation. This includes all the names for parts of the program and for items of data within it,… Read more »
To compile a program that has multiple source code files, enter them all on the command line, like this:
cl file1.c file2.c file3.c
The compiler outputs a program called file1.exe. To change the name to program1.exe, add an /out linker option:
cl file1.c file2.c file3.c /link /out:program1.exe
And to catch more programming mistakes automatically, we recommend you compile by using either the /W3 or /W4 warning level option:
cl /W4 file1.c file2.c file3.c /link /out:program1.exe
https://msdn.microsoft.com/en-us/library/bb384838.aspx
To compile your program, enter cl simple.c at the developer command prompt.
You can see the executable program name, simple.exe, in the lines of output information that the compiler displays:
Output
c:\simple>cl simple.c
Microsoft (R) C/C++ Optimizing Compiler Version 19.00.23918 for x86
Copyright (C) Microsoft Corporation. All rights reserved.
simple.c
Microsoft (R) Incremental Linker Version 14.00.23918.0
Copyright (C) Microsoft Corporation. All rights reserved.
/out:simple.exe
simple.obj
#include
int main()
{
printf("Hello, World! This is a native C program compiled on the command line.\n");
return 0;
}