【问题标题】:How do I customize the .exe filename for Microsoft cmdline compiler, cl?如何自定义 Microsoft cmdline 编译器 cl 的 .exe 文件名?
【发布时间】:2016-03-11 06:13:36
【问题描述】:

我可以从谷歌搜索中找到的仅有的两个选项是 /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... ]

【问题讨论】:

  • 有趣的是,我的问题被否决了。当然,这看起来像是一个用户错误。但是,我认为我错过琐碎的部分原因是命令选项格式的不一致,即有时选项与其值之间需要“:”。我是 MS 环境的新手。是否有解释通用 cmdline 选项语法的文档?

标签: visual-studio compiler-errors output rename filenames


【解决方案1】:

语法是:

cl /Fetest.exe main.c

没有空格或标点,不是:

cl /Fe:test.exe main.c

Source

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-03-15
    • 2011-09-11
    • 2012-10-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多