I am using VS2010 on a C++ project using opencv. Many of the calls in opencv have default parameters for the last few parameters to functions. However, when omitting these parameters in function calls, Visual Studio complains and says "functionname: too few arguments for call
Is this a quirk of visual studio? Is it a setting somewhere that I can turn off? Why is this occurring. The code compiles fine under g++.
edit
As an example,
#include <cv.h>
#include <cxcore.h>
int main()
{
CvMat *rotation_vector = cvCreateMat(3,3, CV_64FC1);
double rotation[] = { 0, 1, 0,
-1, 0, 0,
0, 0, 1 };
cvInitMatHeader(rotation_vector, 3, 3, CV_64FC1, rotation, 2147483647); // works
cvInitMatHeader(rotation_vector, 3, 3, CV_64FC1, rotation); // doesn't work
return 0;
}
The declaration for
cvInitMatHeader()is this:The definition of
CV_DEFAULTlooks something like this:So it appears that your Visual C++ compiler is actually compiling in C mode and not C++ mode. In C mode,
__cpluspluswould not be defined, soCV_DEFAULTexpands to nothing. Therefore, it appears that the function declaration does not have default parameters.Check your project settings and make sure you’re compiling the code in C++ mode. That is, ensure that the
/Tpor/TPcompiler switch is enabled. You should also make sure your C++ files have the.cppfile extension.