/fe(名称 EXE 文件)不起作用

/Fe (Name EXE File) is not working

本文关键字:文件 不起作用 EXE 名称 fe      更新时间:2023-10-16

我想在Windows 7,Visual Studio 2010中使用编译cpp源文件

Microsoft (R) C/C++ Optimizing Compiler Version 16.00.40219.01 for x64

当我执行以下操作时

>cl /EHs main.cpp -o test

我得到了

cl : Command line warning D9035 : option 'o' has been deprecated and will be removed in a future release

还行,很公平。我已经检查了这个页面/Fe(名称 EXE 文件(。此选项对我不起作用。它给了我这个错误

cl : Command line warning D9024 : unrecognized source file type 'test', object file assumed
main.cpp
Microsoft (R) Incremental Linker Version 10.00.40219.01
Copyright (C) Microsoft Corporation.  All rights reserved.
/out:main.exe
main.obj
test
LINK : fatal error LNK1181: cannot open input file 'test.obj' 

现在我应该如何激活此选项?我总是觉得很难阅读MSDN Library.它一点也不友好。

请注意,/Fe 和文件名之间没有空格。

cl /EHs /Fetest.exe main.cpp

或者,您可以使用冒号语法:

cl /EHs /Fe: test.exe main.cpp
您可以使用

以下方法实现相同的目标

cl /Ehs main.cpp /link /OUT:test.exe

/link告诉 cl 将这些选项传递给链接器,/OUT指定输出文件的名称。