A weird error I don't understand.

I am getting the weirdest error ever when compiling my code. I am using the Eclipse compiler (I find it works very well, don't judge). Here is the code I am running (NOTE: It doesnt matter on the program, I just included the one I am running for testing purposes):
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#include <iostream>
#include <cstdlib>
using namespace std;

//Globals
string theboard[9] = {"-", "-", "-", "-", "-", "-", "-", "-", "-"};
int showboard();
int movecheck();
int move;
int turn = 0;
bool gameover();
bool over = false;

//Main
int main()
{

	cout << "Two player Tic Tac Toe!" << endl;

	showboard();
	cout << endl << "First Player (x), where would you like to move (number on grid below corresponds to board spot)?" << endl;
	cout << "0 1 2" << endl << "3 4 5" << endl << "6 7 8" << endl << endl << "Choice: ";
	cin >> move;
	movecheck();
	showboard();
	cout << "Second Player (o), where would you like to move?" << endl << "Choice: ";
	cin >> move;
	movecheck();
	showboard();
	while(over == false)
	{
		cout << "First player: ";
		cin >> move;
		movecheck();
		showboard();
		gameover();


		cout << "Second player: ";
		cin >> move;
		movecheck();
		showboard();
		gameover();

	}


	system("PAUSE");
	return 0;
}

//Functions

//Show the Board
int showboard()
{
cout << endl << theboard[0] << " " << theboard[1] << " " << theboard[2] << endl << theboard[3] << " " << theboard[4] << " " << theboard[5] << endl << theboard[6] << " " << theboard[7] << " " << theboard[8] << endl;
return 0;
}

//Check if move is valid
int movecheck()
{
	turn = turn + 1;
	if(theboard[move] != "-")
	{
		cerr << "Someone already went there, try again!" << endl;

	}
	else
	{
		if(turn % 2 == 0)
		{
			theboard[move] = "o";
		}
		else
		{
			theboard[move] = "x";
		}

	}
	return 0;
}

//Check whether game is over
bool gameover()
{
	if(turn % 2 == 0)
	{
		if((theboard[0]=="x" && theboard[1]=="x" && theboard[2]=="x"))
		{
			cout << endl << endl << "Player 1 (x) wins!" << endl;
			over = true;
		}
		else
		{
			over = false;
		}

	}
	else
	{
		if((theboard[0]=="o" && theboard[1]=="o" && theboard[2]=="o"))
		{
			cout << endl << endl << "Player 2 (o) wins!" << endl;
			over = true;
		}
		else
		{
			over = false;
		}
	}

}

And here is my error:
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot open output file TestOfTicTacToe.exe: Permission denied
I cannot figure it out. HELP!
Last edited on
I checked: Windows 7 64 bit OS. I have GCC 4.7.0 installed CORRECTLY (Acording to my TEACHERS directions!). It also happens when I write a program on Ubuntu. Help?
In what directory is supposed to be the executable ? Windows require administrator privileges to write in some locations.

Is the executable already running ? If yes, then this is normal. Check task manager and close the process first.
Topic archived. No new replies allowed.