error C2065: 'CEPROPSPEC' : undeclared identifier(EDB数据库使用问题)(急)

xdw523570601 2010-11-20 08:10:52
有人发过这个问题,但是我没有解决,急求大家帮忙


问题描述:
想使用一下Wince的EDB数据库,通过API函数来操作它。
但是编译的时候提示这些函数还有一些变量没有定义。
按照书上和网上的说法,已经在“预处理器”中定义了EDB。
但提示的错误还是不变。

[code=C/C++
1>.\DBStudent.cpp(68) : error C2065: 'CEPROPSPEC' : undeclared identifier
1>.\DBStudent.cpp(68) : error C2146: syntax error : missing ';' before identifier 'dbPropInfo'
1>.\DBStudent.cpp(68) : error C2065: 'dbPropInfo' : undeclared identifier
1>.\DBStudent.cpp(70) : error C2228: left of '.wVersion' must have class/struct/union
1>.\DBStudent.cpp(71) : error C2228: left of '.propid' must have class/struct/union
1>.\DBStudent.cpp(72) : error C2228: left of '.pwszPropName' must have class/struct/union
1>.\DBStudent.cpp(73) : error C2228: left of '.cchPropName' must have class/struct/union
1>.\DBStudent.cpp(73) : error C2228: left of '.pwszPropName' must have class/struct/union
1>.\DBStudent.cpp(74) : error C2228: left of '.dwFlags' must have class/struct/union
1>.\DBStudent.cpp(76) : error C2228: left of '.wVersion' must have class/struct/union
1>.\DBStudent.cpp(77) : error C2228: left of '.propid' must have class/struct/union
1>.\DBStudent.cpp(78) : error C2228: left of '.pwszPropName' must have class/struct/union
1>.\DBStudent.cpp(79) : error C2228: left of '.cchPropName' must have class/struct/union
1>.\DBStudent.cpp(79) : error C2228: left of '.pwszPropName' must have class/struct/union
1>.\DBStudent.cpp(80) : error C2228: left of '.dwFlags' must have class/struct/union
1>.\DBStudent.cpp(82) : error C2228: left of '.wVersion' must have class/struct/union
1>.\DBStudent.cpp(83) : error C2228: left of '.propid' must have class/struct/union
1>.\DBStudent.cpp(84) : error C2228: left of '.pwszPropName' must have class/struct/union
1>.\DBStudent.cpp(85) : error C2228: left of '.cchPropName' must have class/struct/union
1>.\DBStudent.cpp(85) : error C2228: left of '.pwszPropName' must have class/struct/union
1>.\DBStudent.cpp(86) : error C2228: left of '.dwFlags' must have class/struct/union
1>.\DBStudent.cpp(88) : error C2228: left of '.wVersion' must have class/struct/union
1>.\DBStudent.cpp(89) : error C2228: left of '.propid' must have class/struct/union
1>.\DBStudent.cpp(90) : error C2228: left of '.pwszPropName' must have class/struct/union
1>.\DBStudent.cpp(91) : error C2228: left of '.cchPropName' must have class/struct/union
1>.\DBStudent.cpp(91) : error C2228: left of '.pwszPropName' must have class/struct/union
1>.\DBStudent.cpp(92) : error C2228: left of '.dwFlags' must have class/struct/union
1>.\DBStudent.cpp(95) : error C2228: left of '.wVersion' must have class/struct/union
1>.\DBStudent.cpp(96) : error C2228: left of '.propid' must have class/struct/union
1>.\DBStudent.cpp(96) : error C2065: 'CEVT_STREAM' : undeclared identifier
1>.\DBStudent.cpp(97) : error C2228: left of '.pwszPropName' must have class/struct/union
1>.\DBStudent.cpp(98) : error C2228: left of '.cchPropName' must have class/struct/union
1>.\DBStudent.cpp(98) : error C2228: left of '.pwszPropName' must have class/struct/union
1>.\DBStudent.cpp(99) : error C2228: left of '.dwFlags' must have class/struct/union
1>.\DBStudent.cpp(102) : error C3861: 'CeCreateDatabaseWithProps': identifier not found
1>.\DBStudent.cpp(164) : error C3861: 'CeMountDBVolEx': identifier not found
1>.\DBStudent.cpp(171) : error C3861: 'CeCreateSession': identifier not found
1>.\DBStudent.cpp(174) : error C3861: 'CeOpenDatabaseInSession': identifier not found
1>.\DBStudent.cpp(195) : error C3861: 'CeOpenDatabaseInSession': identifier not found
1>.\DBStudent.cpp(362) : error C3861: 'CeOpenStream': identifier not found
1>.\DBStudent.cpp(371) : error C3861: 'CeStreamWrite': identifier not found
1>.\DBStudent.cpp(378) : error C3861: 'CeStreamSaveChanges': identifier not found
1>.\DBStudent.cpp(482) : error C3861: 'CeOpenStream': identifier not found
1>.\DBStudent.cpp(491) : error C3861: 'CeStreamSetSize': identifier not found
1>.\DBStudent.cpp(501) : error C3861: 'CeStreamWrite': identifier not found
1>.\DBStudent.cpp(509) : error C3861: 'CeStreamSaveChanges': identifier not found
][/code]



...全文
321 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
computerprogramme 2010-12-30
  • 打赏
  • 举报
回复
楼主问题解决了吗?期盼能给解决办法!
xdw523570601 2010-11-22
  • 打赏
  • 举报
回复
#include "StdAfx.h"
#include "DBStudent.h"

//构造函数
CDBStudent::CDBStudent(void)
{
ZeroMemory(&m_VolGUID,sizeof(m_VolGUID)); //存储数据库文件卷标识
m_hDB = INVALID_HANDLE_VALUE; //存储数据库句柄
m_ceOid = 0; //存储数据库对象标识
m_hSession = INVALID_HANDLE_VALUE; //会话句柄
}

//析构函数
CDBStudent::~CDBStudent(void)
{
}

/*--------------------------------------------------------------------
【函数介绍】: 在数据库卷中,新建数据库
【入口参数】: pCeGuid : 数据库卷ID
strDBName : 数据库名
【出口参数】:
【返回 值】: TRUE:成功; FALSE:失败
---------------------------------------------------------------------*/
BOOL CDBStudent::DB_Create_Student( CEGUID * pCeGuid, /*数据库文件卷名称*/
const LPCTSTR strDBName /*数据库名称*/)
{
//定义数据库基本信息
CEDBASEINFOEX DBInfo;
//填充DBInfo信息
memset(&DBInfo, 0, sizeof(CEDBASEINFOEX)) ;
DBInfo.wVersion = CEDBASEINFOEX_VERSION; //版本
DBInfo.dwFlags |= CEDB_VALIDDBFLAGS | CEDB_VALIDNAME | CEDB_VALIDSORTSPEC; //标识
DBInfo.wNumSortOrder = 2; //索引个数
wcscpy(DBInfo.szDbaseName , DBTABLENAME); //数据库名
//定义第1个排序方式
DBInfo.rgSortSpecs[0].wVersion = SORTORDERSPECEX_VERSION;
DBInfo.rgSortSpecs[0].wNumProps = 1;
//指定PID_NO为唯一索引
DBInfo.rgSortSpecs[0].wKeyFlags = CEDB_SORT_UNIQUE;
DBInfo.rgSortSpecs[0].rgPropID[0] = PID_NO; //学生编号
DBInfo.rgSortSpecs[0].rgdwFlags[0] = CEDB_SORT_DESCENDING;

//定义第2个排序方式
DBInfo.rgSortSpecs[1].wVersion = SORTORDERSPECEX_VERSION;
DBInfo.rgSortSpecs[1].wNumProps = 1;
DBInfo.rgSortSpecs[1].wKeyFlags = 0;
DBInfo.rgSortSpecs[1].rgPropID[0] = PID_NAME; //学生姓名
DBInfo.rgSortSpecs[1].rgdwFlags[0] = CEDB_SORT_DESCENDING;

//设置字段属性
CEPROPSPEC dbPropInfo[5];
//学生编号
dbPropInfo[0].wVersion = 1;
dbPropInfo[0].propid = PID_NO;
dbPropInfo[0].pwszPropName = L"编号";
dbPropInfo[0].cchPropName = wcslen(dbPropInfo[0].pwszPropName);
dbPropInfo[0].dwFlags = 0;
//学生姓名
dbPropInfo[1].wVersion = 1;
dbPropInfo[1].propid = PID_NAME;
dbPropInfo[1].pwszPropName = L"姓名";
dbPropInfo[1].cchPropName = wcslen(dbPropInfo[1].pwszPropName);
dbPropInfo[1].dwFlags = 0;
//出生日期
dbPropInfo[2].wVersion = 1;
dbPropInfo[2].propid = PID_BIRTHDAY;
dbPropInfo[2].pwszPropName = L"出生日期";
dbPropInfo[2].cchPropName = wcslen(dbPropInfo[2].pwszPropName);
dbPropInfo[2].dwFlags = 0;
//身高
dbPropInfo[3].wVersion = 1;
dbPropInfo[3].propid = PID_STATURE;
dbPropInfo[3].pwszPropName = L"身高";
dbPropInfo[3].cchPropName = wcslen(dbPropInfo[3].pwszPropName);
dbPropInfo[3].dwFlags = 0;

//照片
dbPropInfo[4].wVersion = 1;
dbPropInfo[4].propid = PID_IMAGE;
dbPropInfo[4].pwszPropName = L"照片";
dbPropInfo[4].cchPropName = wcslen(dbPropInfo[4].pwszPropName);
dbPropInfo[4].dwFlags = 0;

//创建数据库
m_ceOid = CeCreateDatabaseWithProps(pCeGuid, &DBInfo, 5, dbPropInfo);
if (m_ceOid == 0)
{
TRACE(L"创建数据库失败,The Error Code =%d \n",GetLastError());
return FALSE;
}
//
return TRUE;
}
91program 2010-11-20
  • 打赏
  • 举报
回复
结构体没有定义,应该是没有包含相应的头文件
xdw523570601 2010-11-20
  • 打赏
  • 举报
回复
顶帖有分

19,504

社区成员

发帖
与我相关
我的任务
社区描述
硬件/嵌入开发 嵌入开发(WinCE)
社区管理员
  • 嵌入开发(WinCE)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧