不小心编辑了Windows标头,现在什么也没编译 [英] Accidentally edited a windows header, now nothing compiles

查看:109
本文介绍了不小心编辑了Windows标头,现在什么也没编译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个使用Windows Midi界面的程序,在某个时候,我遵循符号的定义并最终出现在Windows标头之一中.在关闭它之前,我一定不小心对其进行了编辑,因为现在当我尝试编译代码时,我会收到数百个错误,例如:

I was writing a program that used the windows midi interface, and at some point I was following the definition of a symbol and ended up in one of the windows headers. I must have accidentally edited it before closing it because now when I try to compile my code, I get literally hundreds of errors like:

Severity    Code    Description Project File    Line    Suppression State
Error (active)  E0020   identifier "LPUINT" is undefined    MidiUtils   C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\joystickapi.h    395 
Error (active)  E0020   identifier "DRVCALLBACK" is undefined   MidiUtils   C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\mmeapi.h 49  
Error (active)  E0020   identifier "LPMMTIME" is undefined  MidiUtils   C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\mmeapi.h 510 
... plus 162 more errors

我不确定具体是弄乱了哪个文件,还是弄乱了我做了什么.有没有一种方法可以将标准Windows标头恢复为应有的状态?

I'm not sure what file specifically I messed up, or what I did to mess it up. Is there a way to revert the standard windows headers back to what they should be?

遵循注释中的建议后,我浏览了包含头文件的文件夹,以查看哪些文件最近被修改过,并且似乎都没有.我不确定从这里要去哪里.如果我的项目有问题,我不确定它可能是什么,因为即使恢复到较早的修订版仍然会遇到错误.

After following a suggestion in the comments, I looked through the folders that contain the header files to see which if any had been modified recently, and it appears that none have. I'm not sure where to go from here. If it's an issue with my project, I'm not sure what it might be, as even reverting to an earlier revision still encounters the error.

推荐答案

我在挖掘了更多内容后发现了这个问题.我有

I found the issue after digging some more. I had

#include "windows.h"
#include "mmsyscom.h"

在头文件中,在我的代码格式化程序运行后,它交换了顺序,使它们按字母顺序排列.事实证明, mmsyscom.h 依赖于 windows.h 中的一堆定义,这是问题的根源.我不确定为什么恢复到先前的提交后仍会继续看到该错误-也许我只是回溯得不够远.无论哪种方式,现在都已解决.

In a header file, and after my code formatter ran it swapped their order so that they were alphabetical. Turns out mmsyscom.h relies on a bunch of definitions in windows.h which was the source of the issue. I'm not sure why I saw continued to see the error when I reverted to a previous commit - maybe I just didn't go back far enough. Either way, it's fixed now.

这篇关于不小心编辑了Windows标头,现在什么也没编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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