我在谷歌搜索中找到的唯一两个选项是/ OUT和/ Fe,但是对我来说都不适用:
使用/ Fe显示没有错误但在当前目录中找不到输出文件:
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
使用/ OUT会出错:
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
编译器的版本:
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... ]