Getting a few errors redefining this opencv macro in c?

asked 2013-10-11 16:02:57 -0600

joeish80829 gravatar image

updated 2013-10-11 18:12:00 -0600

I like to save typing so i created a dll with revised definitions...1 so far successful;

I redefined CV_MAT_TYPE ok it just accepts and returns an int but trying to redefine CV_MAT_ELEM i get a few errors:

test.h:56:1: warning: parameter names (without types) in function declaration [enabled by default] test.c: In function ‘ELEM’: test.c:65:12: error: expected expression before ‘)’ token test.c:65:12: error: request for member ‘data’ in something not a structure or union test.c:65:12: error: request for member ‘step’ in something not a structure or union test.c:66:1: warning: control reaches end of non-void function [-Wreturn-type]

i use the same make file all the time and its aces but here is the contents of my .c :

CvMat* ELEM(mat, elemtype, row, col) { return CV_MAT_ELEM(mat, elemtype, row, col); }

and the contents of my .h

/* #define CV_MAT_ELEM( mat, elemtype, row, col ) \ ((elemtype)CV_MAT_ELEM_PTR_FAST( mat, row, col, sizeof(elemtype))) / CvMat ELEM(mat, elemtype, row, col);

i tried adding a CvMat and CvMat* return but got all the same errors ....added return values like so

CvMat* ELEM(CvMat mat, int elemtype, int row, int col)

and only get this error(and above warning)

65:12: error: expected expression before ‘)’ token

how do i get past this....still new to redefining macros in c

Edit :

new success(it compiles but get error obviously)....this works but i would need a little guideance:

int CV_MAT_ELEM_glue(CvMat mat, int elemtype, int row, int col) { return CV_MAT_ELEM(mat, float, row, col); }

from what i understand CV_MAT_ELEM is supposed to be able to return int double float etc...? #1 how would i define the return then and how would i define elemtype so it would accept the words int float double etc. as arguments

edit retag flag offensive close merge delete

Comments

berak gravatar imageberak ( 2013-10-11 16:12:16 -0600 )edit