5

The only two options that I was able to find from googling are /OUT and /Fe, but neither works for me:

Using /Fe shows no error but no output file found in the current dir either:

C:\hands_on\C>cl /Fe:test.exe main.c
Microsoft (R) C/C++ Optimizing Compiler Version 15.00.30729.01 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

main.c
Microsoft (R) Incremental Linker Version 9.00.30729.01
Copyright (C) Microsoft Corporation.  All rights reserved.

/out::test.exe
main.obj

C:\hands_on\C>ls
main.c  main.obj

Using /OUT gives errors:

C:\hands_on\C>cl /OUT:test.exe main.c
Microsoft (R) C/C++ Optimizing Compiler Version 15.00.30729.01 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

cl : Command line warning D9025 : overriding '/Ot' with '/Os'
cl : Command line warning D9025 : overriding '/Os' with '/Ot'
cl : Command line warning D9002 : ignoring unknown option '/OU'
cl : Command line warning D9002 : ignoring unknown option '/OT'
cl : Command line warning D9002 : ignoring unknown option '/O:'
cl : Command line warning D9002 : ignoring unknown option '/Oe'
cl : Command line warning D9002 : ignoring unknown option '/O.'
cl : Command line warning D9002 : ignoring unknown option '/Oe'
cl : Command line warning D9002 : ignoring unknown option '/Oe'
main.c
Microsoft (R) Incremental Linker Version 9.00.30729.01
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:main.exe
main.obj

The version of the compiler:

C:\hands_on\C>cl
Microsoft (R) C/C++ Optimizing Compiler Version 15.00.30729.01 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

usage: cl [ option... ] filename... [ /link linkoption... ]
Ltf4an
  • 787
  • 5
  • 18
  • 1
    Interestingly, my question got down voted. Granted, it looked like a user error. But, I think part of the reason why I missed the trivial is the inconsistency in the command option format, that is, sometimes ":" is needed between the option and its value. I'm new to MS environment. Is there a document that explains about the general cmdline option syntax? – Ltf4an Dec 06 '15 at 17:03

1 Answers1

8

The syntax is:

cl /Fetest.exe main.c

with no space or punctuation, or:

cl /Fe: test.exe main.c

with a colon and space.

You have a colon but no space:

cl /Fe:test.exe main.c

Source

ChrisF
  • 134,786
  • 31
  • 255
  • 325