C Macro Function Error -


i defined such macro function in c:

#define num_from_dense_mat (ptr, ii, jj, rrow) ((ptr[jj * rrow + ii])) 

and called following:

/*io.h:141*/ float num = num_from_dense_mat(p_mat->p_val_host, i, j, p_mat->row); 

where p_mat->p_val_host float array, , others int number.

but when complie it, got following error:

io.h(141): error: identifier "ptr" undefined  io.h(141): error: identifier "ii" undefined  io.h(141): error: identifier "jj" undefined  io.h(141): error: identifier "rrow" undefined 

should not translate p_mat->p_val_host[j * p_mat->row + i]?

remove space macro definition:

#define num_from_dense_mat(ptr, ii, jj, rrow) ((ptr[jj * rrow + ii]))                          ^^ 

your code defining parameterless macro called num_from_dense_mat.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -