Skip to content

Latest commit

 

History

History
49 lines (32 loc) · 1.37 KB

c-compile-without-linking.md

File metadata and controls

49 lines (32 loc) · 1.37 KB
title ms.date f1_keywords helpviewer_keywords ms.assetid
/c (Compile Without Linking)
11/04/2016
/c
suppress link
cl.exe compiler, compiling without linking
-c compiler option [C++]
c compiler option [C++]
/c compiler option [C++]
8017fc3d-e5dd-4668-a1f7-3120daa95d20

/c (Compile Without Linking)

Prevents the automatic call to LINK.

Syntax

/c

Remarks

Compiling with /c creates .obj files only. You must call LINK explicitly with the proper files and options to perform the linking phase of the build.

Any internal project created in the development environment uses the /c option by default.

To set this compiler option in the Visual Studio development environment

  • This option is not available from within the development environment.

To set this compiler option programmatically

  • To set this compiler option programmatically, see xref:Microsoft.VisualStudio.VCProjectEngine.VCCLCompilerTool.CompileOnly%2A.

Example

The following command line creates the object files FIRST.obj and SECOND.obj. THIRD.obj is ignored.

CL /c FIRST.C SECOND.C THIRD.OBJ

To create an executable file, you must invoke LINK:

LINK firsti.obj second.obj third.obj /OUT:filename.exe

See also

MSVC Compiler Options
MSVC Compiler Command-Line Syntax