Can anybody help me to solve these problems?
1> aokts.cpp
1>functions.obj : error LNK2005: "char const * const askSaveChanges" (?askSaveChanges@@3PBDB) already defined in filefunctions.obj
1>functions.obj : error LNK2005: "char const * const szTitle" (?szTitle@@3PBDB) already defined in filefunctions.obj
1>aokts.obj : error LNK2005: "char const * const askSaveChanges" (?askSaveChanges@@3PBDB) already defined in filefunctions.obj
1>aokts.obj : error LNK2005: "char const * const szTitle" (?szTitle@@3PBDB) already defined in filefunctions.obj
1>filefunctions.obj : error LNK2019: unresolved external symbol "void __cdecl SetSaveState(struct HWND__ *,unsigned int)" (?SetSaveState@@YAXPAUHWND__@@I@Z) referenced in function "void __cdecl FileOpen(struct HWND__ *,bool,int)" (?FileOpen@@YAXPAUHWND__@@_NH@Z)
1>aokts.obj : error LNK2001: unresolved external symbol "void __cdecl SetSaveState(struct HWND__ *,unsigned int)" (?SetSaveState@@YAXPAUHWND__@@I@Z)
1>.\aokts.exe : fatal error LNK1120: 1 unresolved externals
I include files like this:
aokts.cpp:
aokts.h:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
#ifndef AOKTS_H
#define AOKTS_H
#include "../util/utilio.h"
#include "../util/zlibfile.h"
#include "../util/settings.h"
#include "../model/scen.h"
#include "../model/TrigXmlVisitor.h"
#include "../model/TrigXmlReader.h"
#include "editors.h"
#include "editorsDlgProc.h"
#include "mapview.h"
#include "../util/winugly.h"
#include "utilui.h"
#include <commdlg.h>
#include "LCombo.h"
#include "../resource.h" // must be included after Windows stuff
#include <ctype.h>
#include <fstream>
#include "strings.h"
#include "functions.h"
#include "filefunctions.h"
#endif // AOKTS_H
|
strings.h
1 2 3 4
|
#ifndef AOKTS_STRINGS_H
#define AOKTS_STRINGS_H
// HERE I INCLUDE ALL STRINGS const char * or const char array
#endif //AOKTS_STRINGS_H
|
notice that askSaveChanges is defined in strings.h
notice: I added some comments because I got messages here that some classes had been already defined
functions.h
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
#ifndef AOKTS_FUNCTIONS_H
#define AOKTS_FUNCTIONS_H
/*
#include "../util/utilio.h"
#include "../util/zlibfile.h"
*/
#include "../util/settings.h"
#include "../model/scen.h"
/*
#include "../model/TrigXmlVisitor.h"
#include "../model/TrigXmlReader.h"
*/
#include "editors.h"
#include "editorsDlgProc.h"
// #include "mapview.h"
#include "../util/winugly.h"
#include "utilui.h"
#include <commdlg.h>
#include "LCombo.h"
#include "../resource.h" // must be included after Windows stuff
#include <ctype.h>
#include <fstream>
#include "strings.h"
inline void SetSaveState(HWND window, UINT state);
file menu items.
void UpdateRecentMenu(HMENU menu);
#endif //AOKTS_FUNCTIONS_H
|
filefunctions.h
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
#ifndef AOKTS_FILEFUNCTIONS_H
#define AOKTS_FILEFUNCTIONS_H
#include "../util/utilio.h"
#include "../util/zlibfile.h"
#include "../util/settings.h"
#include "../model/scen.h"
#include "../model/TrigXmlVisitor.h"
#include "../model/TrigXmlReader.h"
#include "editors.h"
#include "editorsDlgProc.h"
#include "mapview.h"
#include "../util/winugly.h"
#include "utilui.h"
#include <commdlg.h>
#include "LCombo.h"
#include "../resource.h" // must be included after Windows stuff
#include <ctype.h>
#include <fstream>
#include "strings.h"
#include "functions.h"
const char *getFilenameFromPath(const char *path);
void FileSave(HWND sheet, bool as, bool write);
void FileOpen(HWND sheet, bool ask, int recent);
void FileClose(HWND sheet, HWND control);
#endif
|