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

问题描述 投票:0回答:2

我想在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
。这一点也不友好。

c++ visual-studio-2010 windows-7 exe
2个回答
4
投票

请注意,

/Fe
和文件名之间没有空格。

cl /EHs /Fetest.exe main.cpp

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

cl /EHs /Fe: test.exe main.cpp

2
投票

您可以使用

实现同样的目标
cl /Ehs main.cpp /link /OUT:test.exe

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

© www.soinside.com 2019 - 2024. All rights reserved.