#include error
-
I have the following problem. I have included this header file many times in my code with no problems. Then I "included" it into a new file which now produces errors in my typedef statement. I really dont know if it is a problem with namespace as I have no idea how to use that correctly anyway. Code for "entity.h"
#include <list.h> using namespace std ; typedef struct { int ref; std::string name; }EntityData; typedef list ENTITYLIST;
How can I include this file with out errors?? Code for "NewFile.cpp"#include "stdafx.h" #include "NewFile.h" #include <list.h> #include "entity.h" //This produces errors from entity.h `:confused:` using namespace std;
Pease help!! --- -
I have the following problem. I have included this header file many times in my code with no problems. Then I "included" it into a new file which now produces errors in my typedef statement. I really dont know if it is a problem with namespace as I have no idea how to use that correctly anyway. Code for "entity.h"
#include <list.h> using namespace std ; typedef struct { int ref; std::string name; }EntityData; typedef list ENTITYLIST;
How can I include this file with out errors?? Code for "NewFile.cpp"#include "stdafx.h" #include "NewFile.h" #include <list.h> #include "entity.h" //This produces errors from entity.h `:confused:` using namespace std;
Pease help!! --- -
I have the following problem. I have included this header file many times in my code with no problems. Then I "included" it into a new file which now produces errors in my typedef statement. I really dont know if it is a problem with namespace as I have no idea how to use that correctly anyway. Code for "entity.h"
#include <list.h> using namespace std ; typedef struct { int ref; std::string name; }EntityData; typedef list ENTITYLIST;
How can I include this file with out errors?? Code for "NewFile.cpp"#include "stdafx.h" #include "NewFile.h" #include <list.h> #include "entity.h" //This produces errors from entity.h `:confused:` using namespace std;
Pease help!! --- -
It didnt understand the list definition in my header file. This is now fixed due to the way I included the list.h file. I.E #include <list> without a .h Thanks anyway. ---
The list.h is the old header file from the old C++ standard and is included to prevent old code from breaking. That is why if you are developing new code you should use the plain <list> header.
Build a man a fire, and he will be warm for a day
Light a man on fire, and he will be warm for the rest of his life! -
I have the following problem. I have included this header file many times in my code with no problems. Then I "included" it into a new file which now produces errors in my typedef statement. I really dont know if it is a problem with namespace as I have no idea how to use that correctly anyway. Code for "entity.h"
#include <list.h> using namespace std ; typedef struct { int ref; std::string name; }EntityData; typedef list ENTITYLIST;
How can I include this file with out errors?? Code for "NewFile.cpp"#include "stdafx.h" #include "NewFile.h" #include <list.h> #include "entity.h" //This produces errors from entity.h `:confused:` using namespace std;
Pease help!! ---Also to make sure your header is included only once you must do the #ifdef stuff
#if !defined __ENTITIY_H
#define __ENTITIY_H
.... /// all declarations here#endif
Best regards, Alexandru Savescu