类类型重定义和基类未定义错误

时间:2014-03-04 07:54:55

标签: c++ redefinition

我有以下代码,它返回以下错误 SFDHelper:'class'类型重定义 - File = sfdhelper.h SFDHelper:基类undefined --sfd_metadatamanager.h

SFDHelper.h:
class SFDHelper
{
protected:

private:

public: 
    SFDHelper();
    ~SFDHelper();
    //FileAction(Create/Modify/Delete) methods
    typedef enum FileAction { faNone, faDelete, faCreate, faChange, } EFileAction;
    #define IS_NOTACT_FILE( action ) ( action == faNone   )
    #define IS_CREATE_FILE( action ) ( action == faCreate )
    #define IS_DELETE_FILE( action ) ( action == faDelete )
    #define IS_CHANGE_FILE( action ) ( action == faChange )

    //Converts CString to String
    std::string convertCStringToString(CString csFile);

    //Split functions 
    std::string split(fs::path strToSplit);
    std::string splitFileName(string strToSplit);
    std::string splitFilePath(fs::path strToSplit);
    std::string splitFileNameFromNameAndSize(fs::path strToSplit);
    std::string splitFileType(string strToSplit);

    //Storage functions 
    void storeInMap(string line,std::map<std::string,std::string> &mymap);
    void storeInMMap(string line,std::multimap<std::string,std::string> &mymmap1,std::multimap<std::string,std::string> &mymmap2);

    //Data retreival functions
    string getFilePathFromFileData(fs::path fileDataRecvd);
    std::string getFileNameFromFileData(fs::path fileDataRecvd);
    string getFileSizeFromFileData(fs::path fileDataRecvd);
    string getFileCRC32FromFileData(fs::path fileDataRecvd);
    int GetCrc32(const string& filePath);

    //File read/write functions 
    void writeDataToFile(string fname, string data, bool append=false);
    string readFileDataInStr(string fname);

    time_int GetTimeMs64();
};

SFDMetadamanager.h:

#include "SFDHelper.h"

class SFD_MetadataManager:public SFDHelper
{

private:


public: 
    SFD_MetadataManager();
    ~SFD_MetadataManager();
    bool isOpenDB;
    bool categoryTableExists;
    bool taggedFileTableExists;
    bool recoveryTableExists;
    std::string mediaScanCompleted;
    std::string appCrashedInPreviousSession;
    bool notYetUpdatedRecoveryTable;

    sqlite3 *dbfile;

    //SqLite functions
    bool ConnectDB ();
    void DisonnectDB ();
    void fireSQLQuery(char* query,vector<vector<string>> &results);
    //void createSQLQuery(EFileAction faAction,std::string filePath);

};

它是一个单继承,其中SFD_Metadatamanager类继承SFDHelper类。 感谢您的帮助。

1 个答案:

答案 0 :(得分:2)

在标题中添加包含警示:

#ifndef SFDHELPER_H
#define SFDHELPER_H

//contents of SFDHelper.h

#endif

和其他标题类似。