以文本方式查看主题

-  计算机科学论坛  (http://bbs.xml.org.cn/index.asp)
--  『 C/C++编程思想 』  (http://bbs.xml.org.cn/list.asp?boardid=61)
----  [求助]missing storage-class or type specifiers 能帮我弄一下吗?  (http://bbs.xml.org.cn/dispbbs.asp?boardid=61&rootid=&id=44089)


--  作者:gaoamin
--  发布时间:3/19/2007 1:21:00 PM

--  [求助]missing storage-class or type specifiers 能帮我弄一下吗?
我就在APP下面定义了一个CDatabase db;
上面的声明也写了。请问下还出现
syntax error : missing ';' before identifier 'db'
'CDatabase' : missing storage-class or type specifiers
missing storage-class or type specifiers
这三个问题,谁能帮我解决一下吗?


谢谢了!!!!!!!!!!!!!!


--  作者:gaoamin
--  发布时间:3/19/2007 1:26:00 PM

--  
救命啊!!!!!!!
--  作者:gaoamin
--  发布时间:3/19/2007 2:05:00 PM

--  
晕。这个问题这么难吗?UP没人了。。。。
我就定义了一个CDatabse db后,就出错了。
C:\Documents and Settings\Administrator\桌面\Personnel\Personnel.cpp(41) : error C2146: syntax error : missing ';' before identifier 'db'
C:\Documents and Settings\Administrator\桌面\Personnel\Personnel.cpp(41) : fatal error C1004: unexpected end of file found
Error executing cl.exe.
--  作者:卷积内核
--  发布时间:3/19/2007 3:38:00 PM

--  
CDatabse db
CDatabse 这个类是哪里来的?没见过哦
--  作者:gaoamin
--  发布时间:3/19/2007 3:41:00 PM

--  
不会吧!!!是用来定义数据库变量的
--  作者:卷积内核
--  发布时间:3/20/2007 7:52:00 AM

--  
我的意思是你包含相应头函数了吗?根据错误提示,好像没有哦。系统默认没有包含它的。
--  作者:gaoamin
--  发布时间:3/20/2007 9:17:00 AM

--  
我在stdafx.h里面声明了个#include <afxdb.h>
你是说这个吗?
--  作者:gaoamin
--  发布时间:3/20/2007 9:19:00 AM

--  
我是按书上的步骤来的!!!帮我想想办法呀!!大哥!!!
--  作者:卷积内核
--  发布时间:3/20/2007 5:33:00 PM

--  
你在CDatabse上按一下F12,看看能不能找到,如果不能就说明你那里根本没有这个类定义。那你不可能编译过的。
--  作者:gaoamin
--  发布时间:3/22/2007 8:49:00 PM

--  
已经找到了。谢谢大哥!!!教我!!!!
--  作者:gaoamin
--  发布时间:3/23/2007 8:14:00 AM

--  
以后,还要大哥我教教我了.
--  作者:jerves
--  发布时间:5/30/2007 7:42:00 AM

--  
我也是出了同样的问题.可不可以教我怎么做呀?急呀.谢谢啦.
--  作者:jerves
--  发布时间:5/30/2007 7:58:00 AM

--  
//在h1.h中定义了类Array1D.
#include "stdafx.h"
#include "h1.h"
template<class T>
class Array2D {
 public:
  Array2D(int r = 0, int c = 0);
  Array2D(const Array2D<T>& m);//copy constructor
  ~Array2D() {delete []row;}
  int Rows() const { return rows;}
  int Columns() const {return cols;}
  Array1D<T>& operator[](int i)const;
  Array2D<T>& operator=(const Array2D<T>& m) const;
  Array2D<T> operator+()const;//unary +
  Array2D<T> operator+(const Array2D<T>& m) const;
  Array2D<T> operator-()const;//unary minus
  Array2D<T> operator-(const Array2D<T>& m) const;
  Array2D<T> operator*(const Array2D<T>& m) const;
  Array2D<T>& operator+=(const T& x);
 private:
  int rows, cols; //number of rows and columns.
  Array1D<T> *row; //array of 1D arrays.
};


出现了以下的编译错误:
:\c++资料与作业\程序\array2d1\h2.h(11) : error C2143: syntax error : missing ';' before '<'
        f:\c++资料与作业\程序\array2d1\h2.h(22) : see reference to class template instantiation 'Array2D<T>' being compiled
f:\c++资料与作业\程序\array2d1\h2.h(11) : error C2501: 'Array1D' : missing storage-class or type specifiers
        f:\c++资料与作业\程序\array2d1\h2.h(22) : see reference to class template instantiation 'Array2D<T>' being compiled
f:\c++资料与作业\程序\array2d1\h2.h(11) : error C2059: syntax error : '<'
        f:\c++资料与作业\程序\array2d1\h2.h(22) : see reference to class template instantiation 'Array2D<T>' being compiled
f:\c++资料与作业\程序\array2d1\h2.h(11) : error C2238: unexpected token(s) preceding ';'
        f:\c++资料与作业\程序\array2d1\h2.h(22) : see reference to class template instantiation 'Array2D<T>' being compiled
f:\c++资料与作业\程序\array2d1\h2.h(21) : error C2143: syntax error : missing ';' before '<'
        f:\c++资料与作业\程序\array2d1\h2.h(22) : see reference to class template instantiation 'Array2D<T>' being compiled
f:\c++资料与作业\程序\array2d1\h2.h(21) : error C2501: 'Array1D' : missing storage-class or type specifiers
        f:\c++资料与作业\程序\array2d1\h2.h(22) : see reference to class template instantiation 'Array2D<T>' being compiled
f:\c++资料与作业\程序\array2d1\h2.h(21) : error C2059: syntax error : '<'
        f:\c++资料与作业\程序\array2d1\h2.h(22) : see reference to class template instantiation 'Array2D<T>' being compiled
f:\c++资料与作业\程序\array2d1\h2.h(21) : error C2238: unexpected token(s) preceding ';'
        f:\c++资料与作业\程序\array2d1\h2.h(22) : see reference to class template instantiation 'Array2D<T>' being compiled


谢谢哪位教我呀.


--  作者:卷积内核
--  发布时间:5/30/2007 9:48:00 AM

--  
h1.h
是怎样定义的?
我随便写的这个没问题啊:
//h1.h
#include "stdafx.h"
template<class T>
class Array1D {
private:
  int rows, cols; //number of rows and columns.
//  Array1D<T> *row; //array of 1D arrays.
};
W 3 C h i n a ( since 2003 ) 旗 下 站 点
苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
140.625ms