Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. #include error

#include error

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestionc++tutorial
6 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Coremn
    wrote on last edited by
    #1

    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!! ---

    C S A 3 Replies Last reply
    0
    • C Coremn

      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!! ---

      C Offline
      C Offline
      Coremn
      wrote on last edited by
      #2

      Ooops, Rather than delete this message I will just post my solution. Use <list> instead of <List.h> :rose: ---

      1 Reply Last reply
      0
      • C Coremn

        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!! ---

        S Offline
        S Offline
        soptest
        wrote on last edited by
        #3

        what is the error? soptest

        C 1 Reply Last reply
        0
        • S soptest

          what is the error? soptest

          C Offline
          C Offline
          Coremn
          wrote on last edited by
          #4

          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. ---

          P 1 Reply Last reply
          0
          • C Coremn

            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. ---

            P Offline
            P Offline
            Paul M Watt
            wrote on last edited by
            #5

            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!

            1 Reply Last reply
            0
            • C Coremn

              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!! ---

              A Offline
              A Offline
              Alexandru Savescu
              wrote on last edited by
              #6

              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

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups