Visual Studio need to rebuild solution for every change

懵懂的女人 提交于 2019-12-24 06:11:53

问题


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.

I have already checked different solutions on stackoverflow:

  • I have checked that my "Build and Run" setting is set to "Always build"
  • The Configuration Manager is also set to "Build"

Additional information:

  • 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.

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:


UPDATE

Here is an in depth explanation of the issue:

  1. I have a class that allows to rotate an object TransformerScript.cpp
  2. I have set the rotation speed to 1.
  3. The object rotates as expected.

  1. Now I change the speed float value from 1 to 0.
  2. I press run (Local Windows Debugger)
  3. This is the output log:

1>------ Build started: Project: Star-Engine, Configuration: Debug x64 ------

1>TransformerScript.cpp

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): 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): 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): warning C4244: 'argument': conversion from 'double' to 'float', possible loss of data

1>Compiling...

1>Generating Code...

1>Skipping... (no relevant changes detected)

1>TestScene.cpp

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): 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): warning C6001: Using uninitialized memory 'coutput'.

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

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

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

  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. Set break point at the position of the speed float value
  2. I press run (Local Windows Debugger)
  3. Sometimes (90% of the cases) an error Prompt pops up. Other times (10% of the cases) everything works as expected

  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!

回答1:


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

  1. Go to Solution > Properties
  2. Check Configuration Properties > Configuration
  3. In my case, the Build flag was not checked for one Project in the Solution



回答2:


If the changes are in a header file you will need to full rebuild for the changes to be reflected I think.



来源:https://stackoverflow.com/questions/45688562/visual-studio-need-to-rebuild-solution-for-every-change

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!