I have a C program called opencv2.0 function :
cvSaveImage( out_img_name, img);
Compiler gcc reports that
too few arguments to function cvSaveImage
The prototype of cvSaveImage in highgui.h is
CVAPI(int) cvSaveImage( const char* filename, const CvArr* image, const int* params CV_DEFAULT(0) )
After I change my call to be
cvSaveImage( out_img_name, img, 0);
The compilation is finally successful. Does it mean default values of arguments for function are only supported in C++ but not C?
Thanks and regards!
Solution. So to fix the error “You've entered too many arguments for this function” you need to go through the content of the cell, character-by-character, to ensure that there are no syntax errors. In other words, you need to check whether all opened brackets are closed and all commas are properly in place.
Too few arguments means fewer arguments than the number of required parameters for the function. If this situation occurs in a safe call, an error of type program-error must be signaled; and in an unsafe call the situation has undefined consequences.
Functions with three arguments (triadic function) should be avoided if possible. More than three arguments (polyadic function) are only for very specific cases and then shouldn't be used anyway.
Series: Functions Functions can define default argument values, functions can be called with keyword arguments, and functions can be written to accept any number of arguments.
Correct - Standard C does not support default arguments, neither in the C89 standard nor in the C99 standard (nor in the C2011 standard). There may be compiler-specific extensions to support it in some compilers, but it is not standard.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With