Build Error from changing cout string

I'm not even sure I stated the title right. I just started a tutorial series to learn C++. I'm using eclipse and mingw. I typed out this simple code and built the project. I found a typo in what I wanted as my output so I changed it and ran it again. From just adding a colon I get an error warning and it doesn't actually come out in the console. It displays the old phrase I had typed without a colon. Its like the old phrase without the colon is stored and I can't write over it or something.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <iostream>
using namespace std;

int main() {

	cout << "What is your name?: " << flush;
	string input;
	cin >> input;
	cout << "You entered: " << input << endl;

	cout << "Enter a Number: " << flush;
	int value;
	cin >> value;
	cout << "You entered: " << value << endl;

	return 0;
}

ORIGINAL

#include <iostream>
using namespace std;

int main() {

	cout << "What is your name?: " << flush;
	string input;
	cin >> input;
	cout << "You entered: " << input << endl;

	cout << "Enter a Number: " << flush;
	int value;
	cin >> value;
	cout << "You entered " << value << endl;

	return 0;
}

Last edited on
What is the difference between the two versions? They are just exactly the same.
In the last cout containing "You entered" I added a colon to it. And now when I run it again it gives an error message and still has no colon.
Last edited on
Include this header :
#include <string>
04:43:23 **** Incremental Build of configuration Debug for project Variables ****
Info: Internal Builder is used for build
g++ -o Variables.exe "src\\Variables.o"
c:/mingw/bin/../lib/gcc/mingw32/5.3.0/../../../../mingw32/bin/ld.exe: cannot open output file Variables.exe: Permission denied
collect2.exe: error: ld returned 1 exit status

04:43:23 Build Finished (took 124ms)

I put that in but received this same error again.
Enjoy running your program without your compiler :
http://cpp.sh/8i4q
Well if I copy and paste it into a new project it compiles fine. It runs just like the online compiler. The problem is fixing it on the project I have. Is it because I need to terminate the program before running it again? Is there a way to do that?
Apologies. I didn't add the MinGW bin file to my Environment Variables in the Windows settings. Thanks for the help. It was definitely a compiler issue. It works now.
Actually it didn't fix it at all. I still have to restart eclipse each time I fix something that has already been built for it to be rebuilt.
Blame your compiler for life, or pick up a new C++ compiler.
Lol ok. Thanks.
Topic archived. No new replies allowed.