本文介绍了Visual Studio需要为每个更改重建解决方案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用c ++开发游戏引擎.随着我进一步进入项目,我注意到生成的可执行文件通常不会反映最新的代码更改.但是完全清洗解决方案并重建它可以解决问题.不幸的是,对于较大的代码库而言,完全重建不再是可行的选择.

I am currently working on a game engine in c++. As I have progressed further into the project, I have noticed that the resulting executable often does not reflect the latest code changes. But completely cleaning the solution and rebuilding it, fixes the problem. Unfortunately a complete rebuild is not a viable option for a larger code base anymore.

我已经检查了关于stackoverflow的不同解决方案:

I have already checked different solutions on stackoverflow:

  • 我已检查我的构建并运行"设置是否设置为始终"构建"
  • 配置管理器也设置为构建"
  • I have checked that my "Build and Run" setting is set to "Alwaysbuild"
  • The Configuration Manager is also set to "Build"

其他信息:

  • 这是一个OpenGL项目,在c ++中具有GLFWglad
  • 我使用Visual Studio Community 2017版本15.2
  • It is an OpenGL project with GLFW and glad in c++
  • I use Visual Studio Community 2017 Version 15.2

这是一个非常烦人的问题,会导致很多生产力损失,因为每次我想看到更改时,我都必须完全重建整个解决方案.我将不胜感激.请询问是否需要更多信息.

This is a really annoying issue that causes a lot of productivity loss, since I have to completely rebuild the entire solution every time I want to see a change. I would be grateful for any input. Please ask if more information is required.

我不知道这是否有任何意义,但这是在对TestScene.cpp进行少量更改并重新运行代码时得到的:

I don't know if this is of any relevance, but this is what I get when making a small change to TestScene.cpp and rerunning the code:

更新

这里是对该问题的深入解释:

Here is an in depth explanation of the issue:

  1. 我有一个允许旋转对象的类 TransformerScript.cpp
  2. 我将转速设置为1.
  3. 对象将按预期旋转.
  1. 现在,我将速度浮动值从1更改为0.
  2. 我按Run(本地Windows调试器)
  3. 这是输出日志:

1> TransformerScript.cpp

1>TransformerScript.cpp

1> c:\ users \ haeri \ documents \ github \ space-engine \ star-engine \ src \ header \ matrix4f.h(44):警告C4267:'argument':从'size_t'转换为'unsigned int',可能会丢失数据

1>c:\users\haeri\documents\github\space-engine\star-engine\src\header\matrix4f.h(44): warning C4267: 'argument': conversion from 'size_t' to 'unsigned int', possible loss of data

1> c:\ users \ haeri \ documents \ github \ space-engine \ star-engine \ src \ header \ matrix4f.h(44):警告C4244:'正在初始化':从'float'转换为'int ',可能会丢失数据

1>c:\users\haeri\documents\github\space-engine\star-engine\src\header\matrix4f.h(44): warning C4244: 'initializing': conversion from 'float' to 'int', possible loss of data

1> c:\ users \ haeri \ documents \ github \ space-engine \ star-engine \ src \ header \ matrix4f.h(45):警告C4267:'argument':从'size_t'转换为'unsigned int',可能会丢失数据

1>c:\users\haeri\documents\github\space-engine\star-engine\src\header\matrix4f.h(45): warning C4267: 'argument': conversion from 'size_t' to 'unsigned int', possible loss of data

1> c:\ users \ haeri \ documents \ github \ space-engine \ star-engine \ src \ source \ transformerscript.cpp(13):警告C4244:'argument':从'double'转换为'float ',可能会丢失数据

1>c:\users\haeri\documents\github\space-engine\star-engine\src\source\transformerscript.cpp(13): warning C4244: 'argument': conversion from 'double' to 'float', possible loss of data

1>正在编译...

1>Compiling...

1>正在生成代码...

1>Generating Code...

1>正在跳过...(未检测到相关更改)

1> TestScene.cpp

1>TestScene.cpp

1> Star-Engine.vcxproj-> C:\ Users \ haeri \ Documents \ github \ Space-Engine \ x64 \ Debug \ Star-Engine.exe

1>Star-Engine.vcxproj -> C:\Users\haeri\Documents\github\Space-Engine\x64\Debug\Star-Engine.exe

c:\ users \ haeri \ documents \ github \ space-engine \ star-engine \ src \ source \ glad.c(51):警告C6308:'realloc'可能返回空指针:将空指针分配给'exts_i作为参数传递给"realloc"的"将导致原始内存块被泄漏.

c:\users\haeri\documents\github\space-engine\star-engine\src\source\glad.c(51): warning C6308: 'realloc' might return null pointer: assigning null pointer to 'exts_i', which is passed as an argument to 'realloc', will cause the original memory block to be leaked.

c:\ users \ haeri \ documents \ github \ space-engine \ star-engine \ include \ stb \ stb_image.h(3667):警告C6001:使用未初始化的内存输出".

c:\users\haeri\documents\github\space-engine\star-engine\include\stb\stb_image.h(3667): warning C6001: Using uninitialized memory 'coutput'.

1> Star-Engine.vcxproj-> C:\ Users \ haeri \ Documents \ github \ Space-Engine \ x64 \ Debug \ Star-Engine.pdb(部分PDB)

1>Star-Engine.vcxproj -> C:\Users\haeri\Documents\github\Space-Engine\x64\Debug\Star-Engine.pdb (Partial PDB)

1>完成建筑项目"Star-Engine.vcxproj".

1>Done building project "Star-Engine.vcxproj".

========== Build:1成功,0失败,0最新,跳过0 =========

========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

  1. 已编译的可执行文件开始
  2. 结果是同一个人以相同的速度旋转.
  3. 预期的行为:无浮动,因为浮点数设置为0.
  4. 我被迫清理解决方案"和重建解决方案"
  5. 这在我的笔记本电脑上大约需要1-2分钟
  6. VS完成了新解决方案的重建
  7. 我按Run(本地Windows调试器)
  8. 对象没有移动. (这符合预期)
  1. The compiled executable starts
  2. The result is the same figure rotating at the same speed.
  3. Expected behavior: No rotation, since the float was set to 0.
  4. I am forced to "clean solution" and "Rebuild solution"
  5. This takes about 1 to 2 minutes on my laptop
  6. VS finishes rebuilding the new solution
  7. I press run (Local Windows Debugger)
  8. The Object is not moving. (This is as expected)

替代方法

Alternative approach

  1. 在速度浮动值的位置设置断点
  2. 我按Run(本地Windows调试器)
  3. 有时(在90%的情况下)会弹出错误提示.其他时间(占案例的10%),一切都会按预期进行
  1. 我按确定
  2. 已编译的可执行文件开始
  3. 结果是同一个人以相同的速度旋转.
  4. 预期的行为:无浮动,因为浮点数设置为0.
  5. 触发断点!
  1. I press ok
  2. The compiled executable starts
  3. The result is the same figure rotating at the same speed.
  4. Expected behavior: No rotation, since the float was set to 0.
  5. The break point is not triggered!

推荐答案

我在一个C#项目中遇到了同样的问题,并像这样解决了它:

I had the same issue with one of my C# projects and solved it like this:

  1. 转到解决方案>属性
  2. 检查配置属性>配置
  3. 就我而言,未在解决方案中为一个项目检查Build标志

这篇关于Visual Studio需要为每个更改重建解决方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 18:42