社区
界面
帖子详情
"Global function do not have 'this' pointers"错误原因
zteclx
2009-01-13 09:41:55
自己定义了一个函数showjpg(),用来显示位图.
showjpg(){
CDC *PDC=this->GetDC()
}
这一句报"Global function do not have 'this' pointers"错误.奇怪的是这一句不放在函数中就没有问题了.
...全文
548
4
打赏
收藏
"Global function do not have 'this' pointers"错误原因
自己定义了一个函数showjpg(),用来显示位图. showjpg(){ CDC *PDC=this->GetDC() } 这一句报"Global function do not have 'this' pointers"错误.奇怪的是这一句不放在函数中就没有问题了.
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
4 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
做鸡真好吃
2009-01-14
打赏
举报
回复
showjpg()是全局函数
qwertxp
2009-01-14
打赏
举报
回复
函数是直接写在CPP中的吧,那就是一个全局成员。没有隶属任何类。因此没有this。解决办法,1,把此函数加到相应类中。2,使用AfxGetMainWnd代替this。
fox000002
2009-01-13
打赏
举报
回复
lz 要明白 this 指的是什么
this 指针只能用在 class 中
GetDC 是窗口类的成员函数
lizhigang34
2009-01-13
打赏
举报
回复
showjpg(CDC *PDC) 这里加个参数,你得到DC后,传参数过去.
Google C++ Style Guide(Google C++编程规范)高清PDF
However, implementation code properly belongs in .cc files, and we do not like to have much actual code in .h files unless there is a readability or performance advantage. If an inline
function
...
操作系统(内存管理)
/* Include the sbrk
function
*/ #include void malloc_init() { /* grab the last valid address from the OS */ last_valid_address = sbrk(0); /* we don't have any memory to manage yet, so *just set ...
The Art of Assembly Language Programming
Simplification of Boolean
Function
s 2.6 - What Does This Have To Do With Computers, Anyway? 2.6.1 - Correspondence Between Electronic Circuits and Boolean
Function
s 2.6.2 - Combinatorial ...
Passing
Pointers
to
Function
s in C++
C++ allows you to pass a pointer to a ... To do so, simply declare the
function
parameter as a pointer type. Following a simple example where we pass an unsigned long pointer to a
function
and...
新类class的定义中,类中函数的域名空间很重要!!!
1>.\mainwindow.cpp(7) : error C2673: 'MyMainWindow' :
global
function
s do not have 'this'
pointers
1>main.cpp 1>Generating Code... 1>Build log was saved at "file://d:\Experiment Data\Microsoft Visual ...
界面
15,979
社区成员
115,896
社区内容
发帖
与我相关
我的任务
界面
VC/MFC 界面
复制链接
扫一扫
分享
社区描述
VC/MFC 界面
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章