In C/C++ certain things should technically be one continuous peice of text and not split across multiple lines with newlines.
For example: a string should be like this with no carriage returns or line breaks: "I wandered lonely as a cloud, that floats on high o'er dales and hill. When all at once I saw a crowd, a host of golden daffodils. Beside the lake, beneath the trees, fluttering and dancing in the breeze."
As you can see this is very wide. In C/C++ to split text like this across multiple lines without confusing the compiler,
you do it like this using the line continuation indicator:
1 2 3
"I wandered lonely as a cloud, that floats on high o'er dales and hill. \
When all at once I saw a crowd, a host of golden daffodils. \
Beside the lake, beneath the trees, fluttering and dancing in the breeze."
The \ character MUST BE THE LAST THING BEFORE the newline/carriage return.
This method also applies to #define macro substitution text. So your code would look line this:
1 2 3 4 5 6 7 8 9 10 11
#define grid segptr -> arrayint ManagerProcess::check_result(char t){ \
if ((grid[0][0] == t && grid[0][1] == t && grid[0][2] == t) ||(grid[1][0] == t && grid[1][1] == t && grid[1][2] == t) || \
(grid[2][0]== t && grid[2][1] == t && grid[2][2] == t) ||(grid[0][0] == t && grid[1][0] == t && grid[2][0] == t) || \
(grid[0][1] == t && grid[1][1] == t && grid[2][1] == t) || (grid[0][2] == t && grid[1][2] == t && grid[2][2] == t) || \
(grid[0][0] == t && grid[1][1] == t && grid[2][2] == t) ||(grid[0][2] == t && grid[1][1] == t && grid[2][0] == t) ) \
return 1; \
else if ( grid[0][0] != ' ' && grid[0][1] != ' ' && grid[0][2] != ' ' && grid[1][0] != ' ' && grid[1][1] != ' ' && \
grid[1][2] != ' ' && grid[2][0] != ' ' && grid[2][1] != ' ' && grid[2][2] != ' ' ) \
return -1; \
else return 0;\
}
#define grid segptr -> arrayint ManagerProcess::check_result(char t){\
if ((grid[0][0] == t && grid[0][1] == t && grid[0][2] == t) ||(grid[1][0] == t && grid[1][1] == t && grid[1][2] == t) ||\
(grid[2][0]== t && grid[2][1] == t && grid[2][2] == t) ||(grid[0][0] == t && grid[1][0] == t && grid[2][0] == t) ||\
(grid[0][1] == t && grid[1][1] == t && grid[2][1] == t) || (grid[0][2] == t && grid[1][2] == t && grid[2][2] == t) ||\
(grid[0][0] == t && grid[1][1] == t && grid[2][2] == t) ||(grid[0][2] == t && grid[1][1] == t && grid[2][0] == t) )\
return 1;\
else if ( grid[0][0] != ' ' && grid[0][1] != ' ' && grid[0][2] != ' ' && grid[1][0] != ' ' && grid[1][1] != ' ' &&\
grid[1][2] != ' ' && grid[2][0] != ' ' && grid[2][1] != ' ' && grid[2][2] != ' ' )\
return -1;\
else return 0;\
}
but now I get a different error in this:
Undefined first referenced
symbol in file
ManagerProcess::check_result(char) /var/tmp//cceOtX70.o
ld: fatal: Symbol referencing errors. No output written to a.out
collect2: ld returned 1 exit status
Maybe just change it to a normal function and have done with it. I don't think you can do what you want to do the way you are trying to do it.
See helios's comment earlier :-)