简体   繁体   中英

Visual Studio 2013 C++ not compiling changes

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.

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!

I was having the same issues, and I have sorted it out. To run code with modified changes, just kill the old terminal. ON the bottom window, this can be done by clicking on "code" and selecting "kill terminal".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM