Ask Your Question

How would I rewrap this opencv macro and compile to a .so

asked 2013-10-15 09:54:35 -0500

joeish80829 gravatar image

updated 2013-10-15 10:20:56 -0500

berak gravatar image

I think my makefile is ok ....because i use it successfuly every day but i would like to rewrap this opencv macro

#define CV_ERROR( Code, Msg ) \ { \ cvError( (Code), cvFuncName, Msg, __FILE__, __LINE__ ); \ __CV_EXIT__; \ }

so i can call by CV_E instead of CV_ERROR....i use it alot and this would save typing

my attempts include----shown as .c and .h file contents 1


void CV_ERR( int Code, const char* Msg ) \ { CV_ERROR( Code, Msg ); }


void CV_ERR( int Code, const char* Msg);

i get these errors for that

error: ‘cvFuncName’ undeclared (first use in this function) test.c:16:5: note: each undeclared identifier is reported only once for each function it appears in test.c:16:5: error: label ‘exit’ used but not defined

so to get rid of the first error i added '#define cvFuncName ""' from core_c.h where CV_ERROR is defined...

now i get just

error: label ‘exit’ used but not defined

i see in core_c.h i see this line '#define CV_EXIT goto exit' but i added it and got the latest result again.....any help is appreciated or online resources \

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted

answered 2013-10-15 10:25:28 -0500

Moster gravatar image

updated 2013-10-15 10:25:53 -0500

I just tested it and it works fine this way:


#include <opencv2/core/core.hpp>

#define CV_test( Code, Msg ) CV_Error(Code, Msg)

Somewhere in my cpp:

CV_test( CV_StsOutOfRange, "test outofrange" );
edit flag offensive delete link more
Login/Signup to Answer

Question Tools


Asked: 2013-10-15 09:54:35 -0500

Seen: 376 times

Last updated: Oct 15 '13