微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

MSVC - 不显示编译器版本/版权信息

如何解决MSVC - 不显示编译器版本/版权信息

我有一个生成文件

all: hello.cpp
    cl /EHsc hello.cpp

在开发者 powershell 中,当我输入 nmake 时,我得到:


Microsoft (R) Program Maintenance Utility Version 14.28.29915.0
copyright (C) Microsoft Corporation.  All rights reserved.

        cl /EHsc hello.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 19.28.29915 for x86
copyright (C) Microsoft Corporation.  All rights reserved.

hello.cpp
Microsoft (R) Incremental Linker Version 14.28.29915.0
copyright (C) Microsoft Corporation.  All rights reserved.

/out:hello.exe
hello.obj

有没有办法不显示

Microsoft (R) C/C++ Optimizing Compiler Version 19.28.29915 for x86
copyright (C) Microsoft Corporation.  All rights reserved.

Microsoft (R) Incremental Linker Version 14.28.29915.0
copyright (C) Microsoft Corporation.  All rights reserved.

但只是显示

Microsoft (R) Program Maintenance Utility Version 14.28.29915.0
copyright (C) Microsoft Corporation.  All rights reserved.

        cl /EHsc hello.cpp

hello.cpp
/out:hello.exe
hello.obj

或类似的东西。我只是希望微软的横幅广告不显示,因为它们占用了不必要的行。

解决方法

正如 @dxiv 在评论中所建议的,添加 /nologo 标志似乎有效。修改后的makefile为:

all: hello.cpp
    cl /EHsc /nologo hello.cpp

开发人员 powershell 上的输出是:

Microsoft (R) Program Maintenance Utility Version 14.28.29915.0
Copyright (C) Microsoft Corporation.  All rights reserved.

        cl /EHsc /nologo hello.cpp
hello.cpp

我不知道为什么微软觉得有必要默认显示这个(编译器版本和版权信息)信息,因为它完全没有必要。如果我需要编译器版本进行调试,我应该能够为 UNIX 执行类似于 cl -v 之类的操作。可以在 here 中找到更多标志。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。