Compiling console application from command line using CL.EXE

If you want to compile your console applications from command line, just use the CL.EXE command tool. This is the Microsoft compiler. Imagine you have two files : ConsoleApp1 and Function1.cpp. To compile, just use this:

CL /EHsc ConsoleApp1 Function1

The /EHsc flag is about exception handling.

Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01 for 80×86
Copyright (C) Microsoft Corporation.  All rights reserved.

consoleapp1.cpp
function1.cpp
Generating Code…
Microsoft (R) Incremental Linker Version 9.00.30729.01
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:consoleapp1.exe
consoleapp1.obj
function1.obj

The result is a console application named consoleapp1.exe.

Advertisements

Tagged:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: