【问题标题】:Visual Studio 2013 C++ not compiling changesVisual Studio 2013 C++ 未编译更改
【发布时间】:2016-01-09 21:05:03
【问题描述】:

由于我的教授希望在课堂上使用这种环境,我正在尝试感受一下 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 文件的位置,并在运行代码之前将其删除。这也没有帮助。

【问题讨论】:

  • 你试过Solution -&gt; Clean SolutionSolution -&gt; Rebuild Solution吗?
  • 刚刚试了,没修好。
  • 如果您有任何杀毒软件,请尝试暂时禁用它
  • 没有做出改变。
  • 检查生成的 .exe 文件的日期和时间。不是在未来吗?你的系统时钟工作正常吗?您最近是否更改过时区或类似情况?

标签: c++ visual-studio compilation


【解决方案1】:

从不同的位置加载文件并且它工作。我的猜测是我试图编辑文件的只读版本而不是实际源代码。

感谢大家的帮助!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-11-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-12-30
    • 1970-01-01
    • 2014-11-24
    • 1970-01-01
    相关资源
    最近更新 更多