why am I getting expected primary-expression before { token

The problem is "expected primary-expression before '{' token"

in this part of the code:

----------------------------------------------------------

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
void findPaths()
{
    //
    for( unsigned int i = 0; i < numberMatrix.size(); i++  )
    {
        //
        starts.push_back( {i,0} );
        starts.push_back( {0,i} );
        if( i>=1 && i<=i-2 )
        {
            //
            starts.push_back( {i,numberMatrix.size()-1} );
            starts.push_back( {numberMatrix.size()-1,i} );
        }
    }

}


----------------------------------------------------------------

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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#include <iostream>
#include <vector>
#include <cmath>

/* run this program using the console pauser or add your own getch, system("pause") or input loop */

std::vector< std::vector<int> > numberMatrix;
std::vector< std::vector<int> > starts;

int j, i, k;


void fillNumberMatrix(int i)
{
	//
	if( i % 2 == 1 && ( i + 1 )/2 % 2 == 1 )
	{
		//
		for( int cnt = 0; cnt < i; cnt++ )
        {
            //
            std::vector<int> newColumn;
            numberMatrix.push_back(newColumn);
        }
		for( j = 1; j <= (((i+1)/2)+1)/2 ; j++)
		{
			//

			for( k = 1; k <= i ; k++ )
			{
				//
				if( k >= j && k <= i - j + 1 )
				{
					//
					//numberMatrix[k - 1].push_back(j);
					//std::vector<int> newColumn;
                    //numberMatrix.push_back(newColumn);
					numberMatrix.at(k-1).push_back(j);
				}
				else
				{
					//
					//numberMatrix[k - 1].push_back( numberMatrix[ k - 1 ][ j - 2 ] );
					numberMatrix.at(k-1).push_back(numberMatrix[ k - 1 ][ j - 2 ]);
				}
			}

		}

		for( j = ((((i+1)/2)+1)/2)+1 ; j<=(i+1)/2; j++ )
        {
            //
			for( k = 1; k <= i ; k++ )
			{
				//
				if( k >= j && k <= i - j + 1 )
				{
					//
					//numberMatrix[k - 1].push_back(j);
					//std::vector<int> newColumn;
                    //numberMatrix.push_back(newColumn);
					numberMatrix.at(k-1).push_back((i+1)/2-j+1);
				}
				else
				{
					//
					//numberMatrix[k - 1].push_back( numberMatrix[ k - 1 ][ j - 2 ] );
					numberMatrix.at(k-1).push_back(numberMatrix[ k - 1 ][ j - 2 ]);
				}
			}

        }
        for( int fuck = ( ( i+1 ) / 2 ) - 1; fuck >= 1; fuck-- )
        {
            //
            for( int fucker = 0; fucker < i; fucker++ )
            {
                //
                numberMatrix.at(fucker).push_back( numberMatrix[fucker][fuck-1] );
            }

        }
	}
	else
	{
		//
		std::cout << "this is not a suitable matrix! please type another int: ";
	}
}


void showNumberMatrix()
{
	//
	for( unsigned int i = 0; i < numberMatrix.size(); i++ )
	{
		//
		for( unsigned int j = 0; j < numberMatrix[i].size(); j++ )
		{
			//
			std::cout << numberMatrix[i][j] << " , ";
		}
		std::cout << std::endl << std::endl;
		//std::cout << std::endl;
	}
}

void findPaths()
{
    //
    for( unsigned int i = 0; i < numberMatrix.size(); i++  )
    {
        //
        starts.push_back( {i,0} );
        starts.push_back( {0,i} );
        if( i>=1 && i<=i-2 )
        {
            //
            starts.push_back( {i,numberMatrix.size()-1} );
            starts.push_back( {numberMatrix.size()-1,i} );
        }
    }

}

int main(int argc, char** argv) {

	fillNumberMatrix(9);
	showNumberMatrix();


	return 0;
}

Last edited on
Are you compiling your code as C++11/C++14? Try passing -std=c++14 or -std=c++11 as a command line argument to your compiler.
Man I am in trouble with those compilers, editors. I recently started to use code::blocks for this c++14 issue and now same errors keep coming up.

||unrecognized command line option "-std=c++14"|

it says. I am really pissed off right now.
I believe that you can tell Code Blocks to use a different MinGW installation - just download nuwen MinGW and point it to that:
http://nuwen.net/mingw.html
I have tried that :) installed MinGW and waked through the instructions. Do I have to do anything after those instructions?
Change your Code Blocks settings and point it to C:/MinGW or whatever it needs to understand that that's where you want it to find the compiler and libraries.
Topic archived. No new replies allowed.