gpt4 book ai didi

visual-studio - 如何为 Microsoft cmdline 编译器 cl 自定义 .exe 文件名?

转载 作者:行者123 更新时间:2023-12-02 10:42:13 24 4
gpt4 key购买 nike

我能够通过谷歌搜索找到的唯一两个选项是/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... ]

最佳答案

语法是:

cl /Fetest.exe main.c

没有空格或标点符号,或者:

cl /Fe: test.exe main.c

带有冒号和空格。

你有一个冒号但没有空格:

cl /Fe:test.exe main.c

Source

关于visual-studio - 如何为 Microsoft cmdline 编译器 cl 自定义 .exe 文件名?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34120080/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com