Visual Studio 2013 C++ not compiling changes

≯℡__Kan透↙ 提交于 2020-01-05 09:29:26

问题


I'm trying to get a feel for visual studio, due to my professor wishes to use this environment for class. I've created a simple "Hello World!" project to make VS work for me. Everything worked just fine until recently. Whenever I tell VS to compile and run my code, it will run the program, but it simply runs the initial version of the program, leaving out any changes I have made. I've tried rebuilding the solution, building it, made sure it is set to always build on run, and the correct solutions are building when running. I've also tried saving the file, closing VS, reloading VS, and compiling, but just came across the same issue. I read somewhere how this might be an issue with a timestamp. I don't know where to find the timestamps and make sure they are lined up with the current time.

Any help on this would be awesome.

Here is my code:

#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;
}

EDIT: I've also found the location of the .exe file which VS is running and deleted it before running the code. This also did not help.


回答1:


Loaded the file from a different location and it worked. My guess is I was trying to edit a read only version of the file rather than the actual source.

Thanks for the help guys!



来源:https://stackoverflow.com/questions/34698928/visual-studio-2013-c-not-compiling-changes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!