代码如下:省了些无关的头文件
class CViewView //声明
class Test
{
public:
void GetView1( CViewView * pView); //这个函数需要CViewView 的指针
Test();
virtual ~Test();};
实现代码。省了些无关的头文件
#include "ViewView.h" //包涵头文件
Test::Test()
{}Test::~Test()
{}void Test::GetView1(CViewView *pView)
{//在这里需要用到CViewView
}编译错误:
--------------------Configuration: View - Win32 Debug--------------------
Compiling...
Test.cpp
f:\vcexcample\view\viewview.h(22) : error C2143: syntax error : missing ';' before '*'
f:\vcexcample\view\viewview.h(22) : error C2501: 'CViewDoc' : missing storage-class or type specifiers
f:\vcexcample\view\viewview.h(23) : error C2501: 'GetDocument' : missing storage-class or type specifiers
f:\vcexcample\view\viewview.h(23) : warning C4183: 'GetDocument': member function definition looks like a ctor, but name does not match enclosing class
Error executing cl.exe.View.exe - 3 error(s), 1 warning(s)
class CViewView //声明
class Test
{
public:
void GetView1( CViewView * pView); //这个函数需要CViewView 的指针
Test();
virtual ~Test();};
实现代码。省了些无关的头文件
#include "ViewView.h" //包涵头文件
Test::Test()
{}Test::~Test()
{}void Test::GetView1(CViewView *pView)
{//在这里需要用到CViewView
}编译错误:
--------------------Configuration: View - Win32 Debug--------------------
Compiling...
Test.cpp
f:\vcexcample\view\viewview.h(22) : error C2143: syntax error : missing ';' before '*'
f:\vcexcample\view\viewview.h(22) : error C2501: 'CViewDoc' : missing storage-class or type specifiers
f:\vcexcample\view\viewview.h(23) : error C2501: 'GetDocument' : missing storage-class or type specifiers
f:\vcexcample\view\viewview.h(23) : warning C4183: 'GetDocument': member function definition looks like a ctor, but name does not match enclosing class
Error executing cl.exe.View.exe - 3 error(s), 1 warning(s)
解决方案 »
- 线程函数传递结构体指针问题
- VC6CListCtrl如何给一个项添加图片(图标),请给一个完整的代码
- VC在2003下开发的程序在XP上运行出错(在写入数据库时)
- socket创建不成功,请求高手解决.高分相送
- 紧急求助:各位前辈,如何在VC++6.0中用工程Win32 Application 做一个空白的应用程序窗口
- 怎样实现远程开机?高手请进》》》
- 一个关于class的菜鸟问题,所以给分少少
- 如何注册install shield?
- 内存池和对象池的区别
- 求大神指教,跪求
- 高手指教,我想把“0x00408000”(16进制的字符串)转换成16进制数0x00408000??
- 请问如何由子窗口的句柄得到其view的指针啊
我把#include "ViewView.h"
写在了两个文件里都有错误!不信可以试一下。我搞了一上午了!
这样的话会出什么错误?
编译没错误。
但是在视图中定义一个实例。出现错误! Test m_test;
错误如下:做实验时把新建立一个工程,跟上面对不上了。但是不影响!
--------------------Configuration: Gview - Win32 Debug--------------------
Compiling...
Gview.cpp
c:\program files\microsoft visual studio\myprojects\gview\test.h(16) : error C2061: syntax error : identifier 'CGviewView'
GviewView.cpp
c:\program files\microsoft visual studio\myprojects\gview\test.h(16) : error C2061: syntax error : identifier 'CGviewView'
Generating Code...
Compiling...
Test.cpp
c:\program files\microsoft visual studio\myprojects\gview\gviewview.h(25) : error C2146: syntax error : missing ';' before identifier 'm_test'
c:\program files\microsoft visual studio\myprojects\gview\gviewview.h(25) : error C2501: 'Test' : missing storage-class or type specifiers
c:\program files\microsoft visual studio\myprojects\gview\gviewview.h(25) : error C2501: 'm_test' : missing storage-class or type specifiers
Generating Code...
Error executing cl.exe.Gview.exe - 5 error(s), 0 warning(s)
也要包括Test.h