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):
#include <iostream>
#include <cstdlib>
usingnamespace 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!
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?