我在程序中加入了一個關於 oledb 數據據操作類的頭文件 #include "DOperateA.h" 程序編譯就出以下錯誤? "DOperateA.h"  中定義了 #define UNICODE   #define _UNICODE

解决方案 »

  1.   

    头文件重复定义了.在"DOperateA.h"应该这样定义:
    #ifndef UNICODE
    #define UNICODE
    #endif#ifndef _UNICODE
    #define _UNICODE
    #endif
      

  2.   

    to  byry(百事罐头) :按你說的改了沒效果,我發現最后還有一個錯誤是:Debug/PASE.exe : fatal error LNK1169: one or more multiply defined symbols found
      

  3.   

    DOperateA.h 的內容如下:
    #ifndef UNICODE
    #define UNICODE
    #endif#ifndef _UNICODE
    #define _UNICODE
    #endif#ifndef DBINITCONSTANTS
    #define DBINITCONSTANTS
    #endif#ifndef INITGUID
    #define INITGUID
    #endif#include <stdio.h>
    #include <tchar.h>#include <stddef.h>
    #include <windows.h>
    #include <iostream.h>#include <oledb.h>
    #include <SQLOLEDB.h>
    #include <oledberr.h>
    #include "variablestruct.h"class CDOperateA

    public:
    CDOperateA();
    protected:
    virtual  ~CDOperateA();
    BOOL GetRowData(ClassSubInfo *pInfo,ClassOtherInfo *pOtherInfo,BYTE *pDataBuffer,int bHead);
    BOOL SetRowData(ClassSubInfo *pInfo,ClassOtherInfo *pOtherInfo,BYTE *pDataBuffer);
    BOOL GetRowClassId(BYTE *pDataBuffer,int *ClassId);
    BOOL GetRowClassName(BYTE *pDataBuffer,CString *ClassName);
    void WriteLog(int level,CString str);
    private:IDBInitialize*       pIDBInitialize;
    IDBCreateSession*    pIDBCreateSession;
    IDBCreateCommand*    pIDBCreateCommand;
    ICommandText*        pICommandText;
    IRowset*             pIRowset;
    IRowsetScroll*       pIRowsetScroll;
    IRowsetUpdate*       pIRowsetUpdate;
    IRowsetFind*         pIRowsetFind;
    IAccessor*           pIAccessor;
    HACCESSOR            hAccessor;
    DBCOLUMNINFO*        pDBColumnInfo;
    DBBINDING*           pBindings;
    HROW                 hRows[1];
    HROW*                pRows ;
    ULONG                DataBufOffset;
    ULONG                RecordCount;
    ULONG                GetRows;
    ULONG                Books;
    int                  Cols;
    int                  ClassId;
    int                  iseof;
    int                  isbof;public:
    BOOL InitDataBase(LPCTSTR Sname,LPCTSTR DBname,LPCTSTR Uname,LPCTSTR Upwd);
    BOOL InsertAclass(ClassSubInfo *pInfo,ClassOtherInfo *pOtherInfo);
    BOOL LoadAclass();//(select * from where ) add this key and it's value
    BOOL Findclass(LPCTSTR strKey,LPCTSTR strValue);
    //need IID_IRowsetScroll
    BOOL Getclass(ClassSubInfo *pInfo,ClassOtherInfo *pOtherInfo);//need IID_IRowsetScroll
    BOOL MoveNext();//need IID_IRowsetScroll
    BOOL MovePrev();//need IID_IRowsetScroll
    BOOL DeleteAclass(LPCTSTR strKey,LPCTSTR strValue);//need IID_IRowsetUpdate 
    BOOL UpdateAclass(ClassSubInfo *pInfo,ClassOtherInfo *pOtherInfo);//need IID_IRowsetUpdate
    BOOL UnInitDataBase();
    BOOL SaveClass(ULONG Rows, HROW *pHRow);//need IID_IRowsetUpdate
    }
    ;