我正在尝试感受一下 visual studio,因为我的教授希望在类里面使用这种环境。 我创建了一个简单的“Hello World!”使 VS 为我工作的项目。直到最近一切都很好。每当我告诉 VS 编译并运行我的代码时,它都会运行程序,但它只是运行程序的初始版本,而忽略我所做的任何更改。 我已经尝试重建解决方案,构建它,确保它设置为始终在运行时构建,并且在运行时构建正确的解决方案。 我也尝试过保存文件、关闭 VS、重新加载 VS 和编译,但遇到了同样的问题。 我在某处读到这可能是时间戳的问题。我不知道在哪里可以找到时间戳并确保它们与当前时间对齐。
在这方面的任何帮助都会很棒。
这是我的代码:
#include <iostream>
#include <string>
using namespace std;
int main() {
// Opens the command prompt and displays the phrase to the user.
cout << "Hello World! This is a test to see if updates work." << endl;
/* Pauses the command prompt to allow the user to see what is
displayed inside of the window. * */
string tempString = "Press enter to continue.";
cout << temptString << endl;
cin >> tempString;
cout << tempString << endl;
return 0;
}
编辑: 我还找到了 VS 正在运行的 .exe 文件的位置,并在运行代码之前将其删除。这也没有帮助。
最佳答案
从不同的位置加载文件并且它有效。我的猜测是我试图编辑文件的只读版本而不是实际源。
谢谢大家的帮助!
关于c++ - Visual Studio 2013 C++ 不编译更改,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34698928/