1

I've got a problem of compilation on VS 2012. What can explain that if I modify a header file (.h) and build it an error message saying

"the current source code is different from the version built into"

But it will work fine if I rebuild the entire project?

Thanks Alex

Lucas Henrique
  • 1,380
  • 1
  • 11
  • 15
AlexMars
  • 11
  • 1
  • 1
    Your human-readable code has to match the underlying machine code, so when you change that readable code you have to recompile. Otherwise, say you add six lines of code; until you recompile, that code is never actually compiled to machine code, so that code will never run. Or say you delete five lines of code; until you recompile, that "deleted" code is still part of the machine code, and will still be run. That's why Visual Studio wants you to rebuild the project. – cf- Mar 27 '14 at 10:49
  • Beware of [precompiled headers](http://stackoverflow.com/q/11722944/1174378). – Mihai Todor Mar 27 '14 at 10:50
  • >>Computerfreaker Sorry but a modification in a file doesn't need a total Rebuild of the project to be compiled. A Build should be enough and it's enough for all files in my project. It doesn't work only for one header file ... – AlexMars Mar 27 '14 at 10:57
  • Ah, I missed the part where you mentioned building the project after modifying the header. Ignore my comment, then. Sorry about that. You're correct, a normal build should be sufficient. – cf- Mar 27 '14 at 11:01
  • Hard to tell without actually seeing your header file. – Jabberwocky Mar 27 '14 at 11:02
  • 1
    It's weird because when I got this error one time on a file.h, the only way to compile it properly hereafter is to do a rebuild.... And the error message has appeared "suddenly" because this file was used since two years without any problem... (Same problem in Debug or Release config) – AlexMars Mar 27 '14 at 12:23

0 Answers0