Hi,
actually i'm writing a program that's storing data in a XML-File.
Therefor i've written a library that reads and stores data in XML.
It looks like these:
#include <afx.h>
#include <afxtempl.h>
#include <fstream.h>
#include <string.h>
#include <ctype.h>
#ifndef myXML_cpp
#define myXML_cpp
/* Functionprototypes */
class TAG;
int readXMLFile (ifstream File, TAG &Tag);
int readTag (ifstream File, TAG &NewTag, char already_read);
int CheckClosingTag (ifstream File, CString closeTag);
int writeXMLFile (ofstream File, TAG &Tag);
int writeTag (ofstream File, TAG &Tag);
class TAG
{
private:
CString s_TagName;
CString s_TagContent;
public:
TAG (void);
TAG (TAG const &NewTag);
TAG (CString TagName);
~TAG(void);
CString GetTagContent (void) const;
CString GetTagName (void) const;
void SetTagName (CString TagName);
void SetTagContent (CString TagContent);
void Reset (void);
void operator = (TAG const &source);
CArray <TAG, TAG> SubTags;
};
// class memberfunctions and functionbodies
#endif
But if i include this file (via #include "myXML.cpp" in another file with main function, the linker return for each memberfunction and function the errorcode "LNK2005: <functionname> is already defined in myXML.obj.", although the functions are only defined in this file.
I've spend a lot of time but i could not find the failure so i hope someone can help me.
Thanks!
actually i'm writing a program that's storing data in a XML-File.
Therefor i've written a library that reads and stores data in XML.
It looks like these:
#include <afx.h>
#include <afxtempl.h>
#include <fstream.h>
#include <string.h>
#include <ctype.h>
#ifndef myXML_cpp
#define myXML_cpp
/* Functionprototypes */
class TAG;
int readXMLFile (ifstream File, TAG &Tag);
int readTag (ifstream File, TAG &NewTag, char already_read);
int CheckClosingTag (ifstream File, CString closeTag);
int writeXMLFile (ofstream File, TAG &Tag);
int writeTag (ofstream File, TAG &Tag);
class TAG
{
private:
CString s_TagName;
CString s_TagContent;
public:
TAG (void);
TAG (TAG const &NewTag);
TAG (CString TagName);
~TAG(void);
CString GetTagContent (void) const;
CString GetTagName (void) const;
void SetTagName (CString TagName);
void SetTagContent (CString TagContent);
void Reset (void);
void operator = (TAG const &source);
CArray <TAG, TAG> SubTags;
};
// class memberfunctions and functionbodies
#endif
But if i include this file (via #include "myXML.cpp" in another file with main function, the linker return for each memberfunction and function the errorcode "LNK2005: <functionname> is already defined in myXML.obj.", although the functions are only defined in this file.
I've spend a lot of time but i could not find the failure so i hope someone can help me.
Thanks!