c++ -/Fe(名称 EXE 文件)不工作

标签 c++ visual-studio-2010 compiler-construction windows-7 exe

我想在 windows 7 和 visual studio 2010 中编译一个 cpp 源文件

Microsoft (R) C/C++ 优化编译器版本 16.00.40219.01 for x64

当我执行以下操作时

>cl/EHs main.cpp -o test

我得到了

cl:命令行警告 D9035:选项“o”已被弃用,将在未来版本中删除

好吧,很公平。我查看了此页面 /Fe (Name EXE File) .这个选项对我不起作用。它给了我这个错误

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

关于c++ -/Fe(名称 EXE 文件)不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25300894/

相关文章:

c++ - 以下示例中给出的结构有什么不幸之处?

c++ - Arduino 类中未声明的字符串

c# - 我怎样才能使窗体背景透明而不是其他控件

c++ - Visual C++ 异或加密错误

c# - 你能使 VB.NET 编译像 C# 一样严格吗?

c++ - 在 Qt 中解析 XML 文件

c++ - 模板参数数量错误

visual-studio - Visual Studio 2010 中的滚动锁定错误

java - 为什么我的 switch 语句中不能有重复的 case?

c++ - 无法编译项目,缺少 io.h 文件