开发者

Why do i get this message in Microsoft Visual C++ 2010 Express

开发者 https://www.devze.com 2023-03-12 22:46 出处:网络
#include <iostream> using namespace std; int main() { bool x = true; bool y = false; if(x) { cout << \"if works\";
#include <iostream>
using namespace std;

int main() {
  bool x = true;
  bool y = false;

  if(x) {
    cout << "if works";
  }   

  if(y==false) {
    cout << "else works";
  }

  int z;
  cin >> z;
}

This is a small code that I compiled using Microsof开发者_如何学Pythont Visual C++ 2010 Express Edition. When I compile I get a message saying that Your project is out of date. Why do I get this message ?

If the above code is really out of date, I will be thankful to any suggestion?


You probably hit F5. Which is: run in debug, NOT compile (at least not in C++/VS terms).

It detects that your code is different from the one used to compile your binaries.

If you have this code:

int main() 
{ 
    cout << "test"; 
    return 0;
}

And you compile, that's version 1 of your exe.

Then you change the code in

int main() 
{
    cout << "test1";
    cout << "test2";
    return 0;
}

Now you hit F5, you are essentially still trying to debug version 1 of your exe since you have not compiled version 2 of your source code into version 2 of your assembly.

That's why it gives you the warning. If I recall correctly you can set a checkbox on that popup to always rebuild. (not sure!)


Projects are out of date dialog will pop up when the time stamp of input files(source code) are newer than output files(binaries).

It has nothing to do with the source code being out of date(If you are thinking in that direction).

Delete all the Debug folder, recompile and then run the project and it should work.

0

精彩评论

暂无评论...
验证码 换一张
取 消