与"char *"类型的参数不兼容 [英] incompatible with parameter of type "char *"
本文介绍了与"char *"类型的参数不兼容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的库(.h文件)中有一些C ++代码.
我正在Visual Studio 2010中使用Win32 C ++项目.
这是我的代码:
I have some C++ code inside of my library (.h file).
I''m using a Win32 C++ Project in Visual Studio 2010.
Here''s my code:
virtual char* get_T() { return this->t; }
virtual void set_T(char *value) { this->t = value; }
void Draw()
{
int img;
img = ImageAdd(get_T);
}
private:
int m_width;
int m_hight;
int m_x;
int m_y;
string m_text;
string m_texture;
char *t;
ImageAdd()的原型是:
And the prototype for ImageAdd() is:
int ImageAdd(char *filename);
我不断收到此错误:
"IntelliSense:类型为char *(dfButton :: *)()"的参数与类型为"char *"的参数不兼容
我需要知道如何解决这个问题.
如果需要更多帮助,请告诉我.
I keep getting this error:
"IntelliSense: argument of type "char *(dfButton::*)()" is incompatible with parameter of type "char *"
I need to know how to fix this.
If I need to post more to help let me know.
推荐答案
您可以尝试添加方括号以调用该函数,而不是尝试返回其地址...
You could try adding brackets to call the function, instead of trying to return its address...
img = ImageAdd(get_T);
成为
img = ImageAdd(get_T());
这篇关于与"char *"类型的参数不兼容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文