Doesn't look like it was parced correctly even. But it looks fine to me.
Maybe it doesn't like newlines? Tried without them.
Maybe it must be in UPPER CASE? I honestly have no idea.
Maybe it doesn't like ////comments?
#define fill(where_l, where_r, where_t, where_b, what_l, what_r, what_t, what_b) \
\
////lt \
*p++ = where_l; \
*p++ = where_t; \
*p++ = 0.5f; \
*p++ = 1.0f; \
*p++ = what_l; \
*p++ = what_t; \
\
////rt \
*p++ = where_r; \
*p++ = where_t; \
*p++ = 0.5f; \
*p++ = 1.0f; \
*p++ = what_r; \
*p++ = what_t; \
\
////lb \
*p++ = where_l; \
*p++ = where_b; \
*p++ = 0.5f; \
*p++ = 1.0f; \
*p++ = what_l; \
*p++ = what_b; \
\
////rb \
*p++ = where_r; \
*p++ = where_b; \
*p++ = 0.5f; \
*p++ = 1.0f; \
*p++ = what_r; \
*p++ = what_b; \
Errors:
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(569) : error C2143: syntax error : missing ';' before '++'
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(569) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(570) : error C2143: syntax error : missing ';' before '++'
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(570) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(570) : error C2086: 'int *p' : redefinition
1> c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(569) : see declaration of 'p'
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(571) : error C2143: syntax error : missing ';' before '++'
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(571) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(571) : error C2086: 'int *p' : redefinition
1> c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(569) : see declaration of 'p'
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(572) : error C2143: syntax error : missing ';' before '++'
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(572) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(572) : error C2086: 'int *p' : redefinition
1> c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(569) : see declaration of 'p'
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(573) : error C2143: syntax error : missing ';' before '++'
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(573) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(573) : error C2086: 'int *p' : redefinition
Deleted comments completely, now errors are:
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(568) : error C2143: syntax error : missing ';' before '++'
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(568) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(569) : error C2143: syntax error : missing ';' before '++'
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(569) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(569) : error C2086: 'int *p' : redefinition
1> c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(568) : see declaration of 'p'
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(570) : error C2143: syntax error : missing ';' before '++'
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(570) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(570) : error C2086: 'int *p' : redefinition
1> c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(568) : see declaration of 'p'
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(571) : error C2143: syntax error : missing ';' before '++'
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(571) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(571) : error C2086: 'int *p' : redefinition
1> c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(568) : see declaration of 'p'
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(572) : error C2143: syntax error : missing ';' before '++'
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(572) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(572) : error C2086: 'int *p' : redefinition
1> c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(568) : see declaration of 'p'
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(574) : error C2143: syntax error : missing ';' before '++'
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(574) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(574) : error C2086: 'int *p' : redefinition
1> c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(568) : see declaration of 'p'
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(575) : error C2143: syntax error : missing ';' before '++'
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(575) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(575) : error C2086: 'int *p' : redefinition
1> c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(568) : see declaration of 'p'
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(576) : error C2143: syntax error : missing ';' before '++'
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(576) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(576) : error C2086: 'int *p' : redefinition
1> c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(568) : see declaration of 'p'
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(577) : error C2143: syntax error : missing ';' before '++'
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(577) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(577) : error C2086: 'int *p' : redefinition
1> c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(568) : see declaration of 'p'
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(578) : error C2143: syntax error : missing ';' before '++'
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(578) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(578) : error C2086: 'int *p' : redefinition
1> c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(568) : see declaration of 'p'
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(579) : error C2143: syntax error : missing ';' before '++'
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(579) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(579) : error C2086: 'int *p' : redefinition
1> c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(568) : see declaration of 'p'
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(581) : error C2143: syntax error : missing ';' before '++'
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(581) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(581) : error C2086: 'int *p' : redefinition
1> c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(568) : see declaration of 'p'
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(582) : error C2143: syntax error : missing ';' before '++'
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(582) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(582) : error C2086: 'int *p' : redefinition
1> c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(568) : see declaration of 'p'
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(583) : error C2143: syntax error : missing ';' before '++'
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(583) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(583) : error C2086: 'int *p' : redefinition
1> c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(568) : see declaration of 'p'
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(584) : error C2143: syntax error : missing ';' before '++'
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(584) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(584) : error C2086: 'int *p' : redefinition
1> c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(568) : see declaration of 'p'
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(585) : error C2143: syntax error : missing ';' before '++'
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(585) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(585) : error C2086: 'int *p' : redefinition
1> c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(568) : see declaration of 'p'
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(586) : error C2143: syntax error : missing ';' before '++'
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(586) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(586) : error C2086: 'int *p' : redefinition
1> c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(568) : see declaration of 'p'
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(588) : error C2143: syntax error : missing ';' before '++'
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(588) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(588) : error C2086: 'int *p' : redefinition
1> c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(568) : see declaration of 'p'
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(589) : error C2143: syntax error : missing ';' before '++'
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(589) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(589) : error C2086: 'int *p' : redefinition
1> c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(568) : see declaration of 'p'
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(590) : error C2143: syntax error : missing ';' before '++'
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(590) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(590) : error C2086: 'int *p' : redefinition
1> c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(568) : see declaration of 'p'
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(591) : error C2143: syntax error : missing ';' before '++'
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(591) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(591) : error C2086: 'int *p' : redefinition
1> c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(568) : see declaration of 'p'
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(592) : error C2143: syntax error : missing ';' before '++'
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(592) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(592) : error C2086: 'int *p' : redefinition
1> c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(568) : see declaration of 'p'
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(593) : error C2143: syntax error : missing ';' before '++'
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(593) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(593) : error C2086: 'int *p' : redefinition
1> c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(568) : see declaration of 'p'
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(641) : error C2297: '*' : illegal, right operand has type 'float *'
1>c:\_src\directxsamples\ex_tut2_showjpg\tut2_vertices.cpp(641) : error C2017: illegal escape sequence
It looks like your post is mostly code, please add some more details.
Here is how I use it:
float* p = (float*)malloc(999);
fill(i_im_x, i_im_x + 512.0f,
i_im_y, i_im_y + 512.0f,
0.0f, 1.0f,
0.0f, 1.0f);
You need to do this:
////xx
comments by /* xx */
\\
in following line: *p++ = where_l; \
^ stray space here
This was not obvious because you cannot see that stray space unless you put the cursor there.
\\
in the very last line of the macro: *p++ = what_b; \
^ remove this
Working example:
#define fill(where_l, where_r, where_t, where_b, what_l, what_r, what_t, what_b) \
\
/*lt*/ \
*p++ = where_l; \
*p++ = where_t; \
*p++ = 0.5f; \
*p++ = 1.0f; \
*p++ = what_l; \
*p++ = what_t; \
\
/* rt */ \
*p++ = where_r; \
*p++ = where_t; \
*p++ = 0.5f; \
*p++ = 1.0f; \
*p++ = what_r; \
*p++ = what_t; \
\
/*lb*/ \
*p++ = where_l; \
*p++ = where_b; \
*p++ = 0.5f; \
*p++ = 1.0f; \
*p++ = what_l; \
*p++ = what_b; \
\
/*rb*/ \
*p++ = where_r; \
*p++ = where_b; \
*p++ = 0.5f; \
*p++ = 1.0f; \
*p++ = what_r; \
*p++ = what_b;
int main(int argc, char **argv) {
float* p = (float*)malloc(999);
fill(1, 2, 3, 4, 5, 6, 7, 8)
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.