我有以下代码返回以下错误SFDHelper:'class' type redefinition--File=sfdhelper.hSFDHelper:base class 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 类。提前感谢您的帮助。
将包含保护添加到标头:
#ifndef SFDHELPER_H
#define SFDHELPER_H
//contents of SFDHelper.h
#endif
以及另一个标头的类似内容。