仅禁用警告 D9024(无法识别的文件类型;假设为目标文件) [英] Disable only warning D9024 (unrecognised file type; object file assumed)

查看:71
本文介绍了仅禁用警告 D9024(无法识别的文件类型;假设为目标文件)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个与操作系统无关的 makefile(呃,我知道),它支持 GNU 和 MSVC 编译器(等等).它总是在编译时生成 .o 目标文件,即使在为 MSVC 编译时也是如此(它需要 .obj 文件).这不是一个大问题;cl 发出警告

I have an OS-agnostic makefile (ugh, I know) which supports both GNU and MSVC compilers (among others). It always generates .o object files when compiling, even when compiling for MSVC (which expects .obj files). This is not a major problem; cl issues warning

cl : Command line warning D9024 : unrecognized source file type '.o', object file assumed

继续,编译成功.

我想删除这个难看的命令行警告,并且这个警告,但想不出任何方法来做到这一点.

I'd like to remove this unsightly command line warning, and only this warning, but can't figure out any way to do it.

诸如 IGNORE 似乎没有压制它,例如使用

Arguments like IGNORE don't seem to suppress it, e.g. using

cl -IGNORE:D9024 ...

和抑制代码中生成的警告的技术(如这个)申请此命令行警告.

and techniques (like this one) to suppress warnings generated in-code don't apply for this command line warning.

有什么办法可以抑制D9024吗?

Is there any way to suppress D9024?

否则(最好是),有没有办法告诉 MSVC 提供的 .o 文件是目标文件,这样它就不必假设了?

Otherwise (and preferably), is there a way to tell MSVC that the provided .o files ARE object files, so that it needn't assume so?

推荐答案

通过不使用 cl 执行链接来简化,而是显式调用 MSVC 的 link

Simplified by performing no linking with cl, instead explicitly invoking MSVC's link

这篇关于仅禁用警告 D9024(无法识别的文件类型;假设为目标文件)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆