Visual Studio不编译特定文件 [英] Visual Studio not compiling specific file

查看:364
本文介绍了Visual Studio不编译特定文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 C ++ 进行 OpenGL 游戏,并且正在使用 Visual Studio 2013 。到目前为止,一切正常,但是大约三天以来,更改文件后我的其中一个文件不再编译。奇怪的是,它实际上仅与此一个文件有关。其他所有文件均按预期工作。因此,如果我更改了所述文件中的某些内容(它是 .h文件,其中包含实现), Visual Studio 不会小心。即使我在其中写了一些无法执行的语句,他也会用红色标记它,但是无论如何都不会打扰,因此只会使用一个预先编译的旧版本。如果我删除 build-Debug 文件夹,他将再次编译该文件,并且文件应能正常工作。有什么想法可以解决这个问题吗?

I am working on an OpenGL game in C++ and am using Visual Studio 2013 for it. Until now everything worked fine but since about 3 days, one of my files is no longer compiled when I change it. The strange thing is, it is really just related to this one single file. Every other file works as expected. So if I change something in said file (it is a .h file with implementation in it) Visual Studio doesn't care. Even if I write some unexecutable statement in it, he lines it in red but doesn't bother anyway thus will just use an old, pre-compiled version. If I delete the "build-Debug" folder, he compiles the file again and it works as it should. Any ideas how to solve this problem?

我还意识到, build-Debug文件夹不包含所有带有实现的头文件的.obj文件。

I also realised that the "build-Debug" folder, contains no .obj file for all the header files with implementation in it. Maybe it has something to do with it?

此外,我的一般建筑属性还可以,例如在文件更改时总是编译等等。

Also, my general building properties are okay, like always compile when files change and such stuff.

推荐答案

我最终通过将文件拆分为单独的.h和.cpp文件来最终解决了该问题。尽管这不是我的意图,但我找不到该问题的另一种解决方案。因此,它一定与作为另一个.obj文件的一部分有关,并且可能与某些包含顺序或类似内容有关。

I eventually solved the problem myself by just splitting the file into a seperate .h and .cpp file. While this was not my intention after all I could not find another solution for this problem. Thus it must have had something to do with being part of another .obj file and maybe with some include order or something similar.

这篇关于Visual Studio不编译特定文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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