📅 2014-Sep-24 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ error, opencv ⬩ 📚 Archive
Recently, I saw some code that should clearly give a compile error, but it compiled correctly. Here it is:
#include <opencv/highgui.h>
int main()
{
// Other code here
cvAddSearchPath(input_directory);
// Other code here
return 0;
}
I saw that input_directory
was not defined anywhere in this file. I also checked highgui.h
and any other files it included. No sign of input_directory
anywhere.
The answer came not by pursuing input_directory
, but going after cvAddSearchPath
. It turns out that this is an obsolete function, but OpenCV has retained it so that old code did not break. The reason this code compiled without any errors, is because cvAddSearchPath
was defined to nothing in highgui_c.h
:
/****************************************************************************************
* Obsolete functions/synonyms *
****************************************************************************************/
#define cvAddSearchPath(path)
Tried with: OpenCV 2.4.9 and Ubuntu 14.04