单文档程序,在C**View中加了CMyPicView*pMyPicView = NULL;
在他的构造函数中加了pMyPicView = this;
然后在C**Doc中加上了
BOOL CMyPicDoc::OnOpenDocument(LPCTSTR lpszPathName)
{
if (!CDocument::OnOpenDocument(lpszPathName))
return FALSE;
// TODO: Add your specialized creation code here
extern CMyPicView*pMyPicView; if(pMyPicView) return pMyPicView->ShowPic(lpszPathName);
return TRUE;
}ShowPic()是C**View的函数
有错误
F:\2008-2009自己的程序\MyPic\MyPicDoc.cpp(92) : error C2143: syntax error : missing ';' before '*'
F:\2008-2009自己的程序\MyPic\MyPicDoc.cpp(92) : error C2065: 'pMyPicView' : undeclared identifier
F:\2008-2009自己的程序\MyPic\MyPicDoc.cpp(92) : error C2100: illegal indirection
F:\2008-2009自己的程序\MyPic\MyPicDoc.cpp(94) : error C2227: left of '->ShowPic' must point to class/struct/union
Error executing cl.exe.
怎么回事?
在他的构造函数中加了pMyPicView = this;
然后在C**Doc中加上了
BOOL CMyPicDoc::OnOpenDocument(LPCTSTR lpszPathName)
{
if (!CDocument::OnOpenDocument(lpszPathName))
return FALSE;
// TODO: Add your specialized creation code here
extern CMyPicView*pMyPicView; if(pMyPicView) return pMyPicView->ShowPic(lpszPathName);
return TRUE;
}ShowPic()是C**View的函数
有错误
F:\2008-2009自己的程序\MyPic\MyPicDoc.cpp(92) : error C2143: syntax error : missing ';' before '*'
F:\2008-2009自己的程序\MyPic\MyPicDoc.cpp(92) : error C2065: 'pMyPicView' : undeclared identifier
F:\2008-2009自己的程序\MyPic\MyPicDoc.cpp(92) : error C2100: illegal indirection
F:\2008-2009自己的程序\MyPic\MyPicDoc.cpp(94) : error C2227: left of '->ShowPic' must point to class/struct/union
Error executing cl.exe.
怎么回事?
解决方案 »
- VC 开发“所见即所得”应用工具
- 如何在对话框下面放将菜单?
- 去掉标题栏碰到的问题!!!!!!
- 在C中如何把整数i转换成用Textout输出的字符串?
- 请问一下那种具有扩展效果的对话框是怎么作的?
- 请问哪儿可以down到《windows程序设计》 北京大学出版 Charles Petzold
- 我要添加一个类似excel的控件,有吗?那位能给出,谢谢!
- 请教,vc里workspace的窗体是怎样创建的??(不用别人的控件,dll,lib)
- 如何在CEdit控件中放入文本如"XX",然后把光标停在XX后面?
- MFC Dialog响应WM_CHAR消息
- 求教!新手在Edit Box中的问题。
- extern CMyPicView* pMyPicView;
这个应该放在BOOL CMyPicDoc::OnOpenDocument(LPCTSTR lpszPathName) 上边,成为全局变量
在他的构造函数中加了pMyPicView =new CMPicView();
然后在C**Doc中加上了
BOOL CMyPicDoc::OnOpenDocument(LPCTSTR lpszPathName)
{
if (!CDocument::OnOpenDocument(lpszPathName))
return FALSE; // TODO: Add your specialized creation code here
if(pMyPicView) return pMyPicView->ShowPic(lpszPathName); return TRUE;
}
正确还有就是添加一个头文件#include "MyPicView.h"
在C**View 的类声明前添加声明 class CMyPicView;如下:
class CMyPicView;
class C**View :public cview
{ CMyPicView *pMyPicView ;
};在该类的实现文件(.cpp)添加#include "MyPicView.h"
{
if (!CDocument::OnOpenDocument(lpszPathName))
return FALSE;
// TODO: Add your specialized creation code here
if(pMyPicView) return pMyPicView->ShowPic(lpszPathName);//-------------------97
return TRUE;
}
还是不行~~~
F:\2008-2009自己的程序\MyPic\MyPicDoc.cpp(87) : error C2143: syntax error : missing ';' before '*'
F:\2008-2009自己的程序\MyPic\MyPicDoc.cpp(87) : error C2501: 'pMyPicView' : missing storage-class or type specifiers
F:\2008-2009自己的程序\MyPic\MyPicDoc.cpp(97) : error C2227: left of '->ShowPic' must point to class/struct/union
extern CMyPicView*pMyPicView; //-----------------------87
BOOL CMyPicDoc::OnOpenDocument(LPCTSTR lpszPathName)
{
if (!CDocument::OnOpenDocument(lpszPathName))
return FALSE; // TODO: Add your specialized creation code here
if(pMyPicView) return pMyPicView->ShowPic(lpszPathName);//-------------------97 return TRUE;
}
F:\2008-2009自己的程序\MyPic\MyPicDoc.cpp(97) : error C2027: use of undefined type 'CMyPicView'
f:\2008-2009自己的程序\mypic\mypicdoc.h(12) : see declaration of 'CMyPicView'
F:\2008-2009自己的程序\MyPic\MyPicDoc.cpp(97) : error C2227: left of '->ShowPic' must point to class/struct/union
Error executing cl.exe.