0

快速搞定 vs 编译错误之 cs1583 —— xxx 不是有效的 win32 资源文件

 11 months ago
source link: https://bianchengnan.gitee.io//articles/troubleshoot-vs-compile-error-cs1583/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

之前写了一个小工具用来处理 .rc 文件,有些地方需要优化,周末准备继续优化一下。没想到,遇到了一个意想不到的错误—— xxx.tmp 不是有效的 win32 资源文件。 本文总结了使用 process monitor 快速定位此问题的过程。

优化好代码后准备编译验证,没想到遇到了下图中的错误。

说实话,看到这个错误我是懵逼的。 CSC5A262FDC58864A1891AD4252B55132.TMP 不是有效的 Win32 资源文件。这个 .TMP 文件是什么鬼?难道被我不小心破坏了?不管三七二十一,先删除,重新编译,看看是否还会报错。

不出所料,还是会报这个错误。

赶紧细看一下工程文件,这个报错的工程也没有使用任何资源文件啊。

搞不懂,先用 process monitor 看看再说。

process monitor

启动 process monitor,在 vs 中重新编译,报错后停止监听,通过 Tools -> Process Tree... 打开进程树,快速浏览到关键进程(盯着 Life Time 列看,一般编译涉及到的子进程生存周期都很短)

看到 cdb.exewindbg.exe ,我一下子就明白是怎么回事了。之前为了调试 cvtres.exe 相关逻辑的时候,我通过 gflags.execvtres.exe 设置了 Image File Excute Option

通过 gflags.exe 去掉对 cvtres.exe 的相关设置即可。

这个问题虽然刚开始看报错信息的时候一头雾水,但是使用 process monitor 很简单就解决了。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK