Compile problems

Hi everyone . This is my first post at this forum hell yeah :D
So , I have windows 8 os installed since 3-4 days and i haven't compiled no one project . For example i have orwells c++ compiler but every time I have error in <iostream> . Can you help please ? :)
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
#include<iostream>
#include<cstdlib>
#include<string>
#include<iomanip>
using namespace std;
int main()
{
    int i,j,q,p;
    string board[8][8];
    string top1,top2,kralj1,kralj2;
    int A,B;
    string file[8]={"1","2","3","4","5","6","7","8"};
    string rank[8]={"A","B","C","D","E","F","G","H"};
    for(i=0;i<8;i++){
    for(j=0;j<8;j++){
    board[i][j]=rank[i]+file[j];
    }
    }
getline(cin,top1);
getline(cin,top2);
getline(cin,kralj1);
getline(cin,kralj2);
for(i=0;i<8;i++){
    for(j=0;j<8;j++){
    
if((board[i][j]==top1)||(board[i][j]==top2))
{
for(int q=i;q<i+1;q++)
{
      for(int p=0;p<8;p++)
            {
                       board[q][p]="1";
            }
}
for(q=i;q<8;q++)
{
      for(p=j;p<j+1;p++)
            {
                       board[q][p]="1";
            }
}          
}
}
}
for(i=0;i<8;i++){
for(j=0;j<8;j++){
                                            cout<<board[i][j]<<setw(3);
}
cout<<endl;
}
system("PAUSE");
return 0;
}

cc1plus: warnings being treated as errors
In function 'int main()':
Line 35: warning: name lookup of 'q' changed
Line 8: warning:   matches this 'q' under ISO standard rules
Line 28: warning:   matches this 'q' under old rules

Don't look at meaning I can't compile either it's "Hello World" program roll:

Picture of error :S
http://i.imgur.com/TyQrPnU.png

Once again sorry if I missed a forum and sorry for bad english of course :)
The messages you showed are not errors. They are warnings. You redeclare variable q in the for loop. If to omit other statements then you have

1
2
3
4
5
6
7
8
9
10
int i,j,q,p;

for(int q=i;q<i+1;q++)
{
   // some code
}
for(q=i;q<8;q++)
{
   // some other code
}          



So the compiler warns you that such style of coding is bad.
it's not a problem . Look at Picture of error you will see that i can't compile Hello World lol. These are just a warnings but on the other computer i can run program normally...
anyone help ?
To call function system you have to include header <cstdlib>
Last edited on
Now it works but still i don't know what was the problem haha. Whatever thank you so much :)
The problem is that you shall always include those headers where functions you use are declared.
Topic archived. No new replies allowed.