c++ - Visual Studio 2013 C++ 不编译更改

标签 c++ visual-studio compilation

我正在尝试感受一下 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/

相关文章:

c++ - 在 C++ 中将类型作为返回类型

c# - 如何在新的 cs 文件中覆盖 VS2010 的自动文件夹-> 命名空间映射

c++ - Visual Studio 2017 - 为依赖项禁用 CMake

android - 在持续集成系统 Hudson 中编译 Android 项目?

c++ - flex/bison 中的多个解析器 : include fails

c++ - 为什么 constexpr 不会因索引越界而导致编译失败

c++ - 只是想调用一个库的函数

c++ - 在 for 循环中总结距离

visual-studio - Visual Studio 2015 无法为 Cordova 项目创建发布版本

makefile - 将 $ORIGIN 添加到 LDFLAGS 时遇到困难