error C2143: syntax error : missing ';' before '*....

 error   C2143:   syntax   error   :   missing   ';'   before   '*....
 error   C2501:   'CMyDoc'   :   missing   storage-class   or   type   specifiers   
 error   C2501:   'GetDocument'   :   missing   storage-class   or   type   specifiers  

在任何cpp文件的开头都按这样的顺序Include:  
  #include   "XXXDoc.h"  
  #include   "XXXView.h"  
  #include   "MainFrm.h"  
  注意,Doc的头文件一定要在最前面。这样你的CDemoView和CMyView也可以共享一个CDemoDoc。  
  一般在Cpp中包含文件是要注意类的包含关系,被包含的类定义应该在前面。如果实在有冲突,可以在一个类的头文件中加:class   CXXXDoc;之类的空定义。这样定义过的头文件中可以用CXXXDoc申明指针,但是不能申明实际对象。  

posted on 2007-04-15 21:22 ashura 阅读(17390) 评论(17)  编辑 收藏 引用

评论

# re: error C2143: syntax error : missing ';' before '*.... 2008-10-03 20:58 wsqew

谢谢了,又学到一点知识  回复  更多评论   

# re: error C2143: syntax error : missing ';' before '*.... 2009-04-14 00:57 Sean

受益匪浅 谢谢!  回复  更多评论   

# re: error C2143: syntax error : missing ';' before '*.... 2009-05-27 16:20 aa

我靠 哥们你太牛了  回复  更多评论   

# re: error C2143: syntax error : missing ';' before '*.... 2009-08-26 18:36 Raingo

太感谢了!
我都整了半个小时了!  回复  更多评论   

# re: error C2143: syntax error : missing ';' before '*.... 2009-09-21 16:57 路过

太牛太牛了!!!  回复  更多评论   

# re: error C2143: syntax error : missing ';' before '*.... 2009-11-15 20:05 朱德华

很厉害啊  回复  更多评论   

# re: error C2143: syntax error : missing ';' before '*.... 2009-12-28 13:40 clwk

真的很佩服你,太牛了!  回复  更多评论   

# re: error C2143: syntax error : missing ';' before '*....[未登录] 2010-08-21 12:06 henry

呵呵 太牛了 厉害  回复  更多评论   

# re: error C2143: syntax error : missing ';' before '*.... 2010-09-14 11:34 livis

这个问题在这里结束了,感恩!  回复  更多评论   

# re: error C2143: syntax error : missing ';' before '*.... 2012-04-06 09:31 张敬明

谢谢  回复  更多评论   

# re: error C2143: syntax error : missing ';' before '*.... 2012-06-04 18:55 ym

楼主太厉害了,找了好多资料都没有发现是头文件包含关系的问题!  回复  更多评论   

# re: error C2143: syntax error : missing ';' before '*.... 2012-06-19 20:53 haihai187

我那样弄了还是不行啊,怎么回事呢  回复  更多评论   

# re: error C2143: syntax error : missing ';' before '*.... 2012-08-28 10:09 chenmozhe503

牛逼  回复  更多评论   

# re: error C2143: syntax error : missing ';' before '*.... 2012-12-26 13:36 fad

多谢兄弟,解决了我的难题。  回复  更多评论   

# re: error C2143: syntax error : missing ';' before '*.... 2013-06-12 14:23 甘瑞

void search(struct std *head)
{
?struct std *p;
?p=head->next;
?char num2[8];
?printf("请输入查找学生学号:\n");
?scanf("%s",num2[8]);
?while(num2!=p->sn)??p=p->next;
?if(p!=NULL)?{??printf("\n查询结果为:\n");
??????????? printf("学号? 姓名??? 英语? 数学? 语文 总分\n");
??????????? printf("%s %d%d%d%d \n",p->num,p->name, p->english, p->match, p->chinese,p->sum,);
}
}/*按最高分查询*/  回复  更多评论   

# re: error C2143: syntax error : missing ';' before '*.... 2013-07-19 19:57 主人翁520

本人在VC++6.0的环境下用MFC库创建了原始的窗口,在类CTextView中添加了如下代码:m_btn.Create("按钮", WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON, CRect(0, 0 100, 100),GetParent(),/*this*/123); m_btn.ShowWindow(SW_SHOWNORMAL);
编译是正常的。但是在VC++8.0中添加一样的代码为何会出现如下的错误提示:>f:\c++examples\mfc程序\text\text\textview.cpp(108) : error C2143: 语法错误 : 缺少“)”(在“常量”的前面)
1>f:\c++examples\mfc程序\text\text\textview.cpp(108) : error C2665: “CRect::CRect”: 7 个重载中没有一个可以转换所有参数类型
1> d:\program files\microsoft visual studio 9.0\vc\atlmfc\include\atltypes.h(128): 可能是“CRect::CRect(POINT,SIZE) throw()”
1> d:\program files\microsoft visual studio 9.0\vc\atlmfc\include\atltypes.h(130): 或 “CRect::CRect(POINT,POINT) throw()”
1> 试图匹配参数列表“(int, int)”时
1>f:\c++examples\mfc程序\text\text\textview.cpp(108) : error C2059: 语法错误 : “)”

请各位大虾帮帮忙解释解释,然后再帮我提出解决方案!非常感谢。。。。
  回复  更多评论   

# re: error C2143: syntax error : missing ';' before '*.... 2013-08-27 17:40 your father

牛个毛,都没解决问题~~艹,回去问那几个吃货好,今晚去MB~  回复  更多评论   


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理


<2013年8月>
28293031123
45678910
11121314151617
18192021222324
25262728293031
1234567

导航

统计

常用链接

留言簿(2)

随笔分类

随笔档案

文章分类

文章档案

搜索

最新评论

阅读排行榜

评论排行榜