hard times with referencing pls help

Oct 28, 2016 at 10:09am
undefined reference error in line 34



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
#include <iostream>
#include <string>
#include <vector>
#include <stdlib.h>
using namespace std;
int Trahnspos=0;

int CheckFurther(vector<int>& Queen,int index1);
int Check(vector<int>&Queen,int &index1,int index2)    //checking for 2 index
	{
		index2=index1+1+Trahnspos;
		for(int i =1;i <= Queen.size();i++)
		{
			Queen.at(index1)=i;
			for(int j =1; j <= Queen.size();j++)
			{
				Queen.at(index2)=j;
				if (abs(Queen.at(index1)-Queen.at(index2)) ==abs(i-j) | index1==index2 | Queen.at(index2)-Queen.at(index2)==0){} 
					else
					{
						if(index2==Queen.size())
							{
								CheckFurther(Queen,index1);
							}
							else{
								Trahnspos ++;
								Check(Queen,index1,index2++);
							}
					}
			}
		}
}

int CheckFurther(vector<int>& Queen,int *index1)
{
		if (*index1<Queen.size()-1)
		{
			*index1 = *index1+1;
			Check(Queen,*index1,0);
		}
		else
		{
			for (int i=0 ; i<Queen.size();i++)
			{
				if(i <Queen.size()-1)
				{
				cout<<"/r"<<Queen.at(i)<<endl;;
				}
				else
					{
						cout<<"/r"<<Queen.at(i)<<"/n"<<endl;
					}
			}
		}
}


int main(){
	int Mainindex=0;
	int *index1=&Mainindex;
	int n=10;
	/*cout << "Size of the board ?"<<n<<endl;
	cin.get();*/
	vector<int> Queens(n,0);
	Check(Queens,*index1,0);
}.
Oct 28, 2016 at 10:45am
Could it be because index1 in line 34 is not the same type as index1 in line 8? Pure guess.
Oct 28, 2016 at 10:46am
all im trying to do here by referencing is to make them the same .. *sad confession* :)
Oct 28, 2016 at 12:11pm
Then do that. All you need to make them the same type is... to make them the same type!
Topic archived. No new replies allowed.