English 中文(简体)
视力演播室不允许遗漏缺省参数?
原标题:Visual studio not allowing ommision of default parameters?

我正在使用VS2010号卫星进行C++项目,使用开放式车。 开放式电话中的许多电话对最后几个功能参数有缺省参数。 然而,当在职能电话中忽略这些参数时,演播室视像抱怨说并说<条码>功能名称:太少要求打的论点。

这是视力演播室的座椅吗? 难道这是我可以放弃的一个环境吗? 为什么发生这种情况。 法典将罚款编为g++。

edit

例如,

#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:

CVAPI(CvMat*) cvInitMatHeader( CvMat* mat, int rows, int cols, int type,
    void* data CV_DEFAULT(NULL), int step CV_DEFAULT(CV_AUTOSTEP) ); 

<代码>CV_DEFAULT的定义 看起来如此:

#ifdef __cplusplus
    #define CV_DEFAULT(val) = val
#else
    #define CV_DEFAULT(val)
#endif

So it appears that your Visual C++ compiler is actually compiling in C mode and not C++ mode. In C mode, __cplusplus would not be defined, so CV_DEFAULT expands to nothing. Therefore, it appears that the function declaration does not have default parameters.

检查项目环境 并确保你以C++方式重新汇编该守则。 也就是说,确保<代码>/Tp或/TP汇编器开关。 您还应确保您的C++档案有.cpp文档延期。

问题回答

暂无回答




相关问题
Undefined reference

I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...

C++ Equivalent of Tidy

Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...

Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

typedef ing STL wstring

Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

Window iconification status via Xlib

Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?

热门标签