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. Compiler error when including afxtempl.h

Compiler error when including afxtempl.h

Scheduled Pinned Locked Moved C / C++ / MFC
csharpc++visual-studiosysadminhelp
11 Posts 3 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.
  • P Offline
    P Offline
    piul
    wrote on last edited by
    #1

    I want to use the class CList for my project, but I get the following compiler error as soon as I do #include <afxtempl.h>

    Compiling...
    snaplogger_main.cpp
    WINVER not defined. Defaulting to 0x0501 (Windows XP and Windows .NET Server)
    CSnapLogger.cpp
    WINVER not defined. Defaulting to 0x0501 (Windows XP and Windows .NET Server)
    CDeviceFileParser.cpp
    c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\afxv_w32.h(18) : fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include <windows.h>
    CCommsManager.cpp
    WINVER not defined. Defaulting to 0x0501 (Windows XP and Windows .NET Server)

    C D 2 Replies Last reply
    0
    • P piul

      I want to use the class CList for my project, but I get the following compiler error as soon as I do #include <afxtempl.h>

      Compiling...
      snaplogger_main.cpp
      WINVER not defined. Defaulting to 0x0501 (Windows XP and Windows .NET Server)
      CSnapLogger.cpp
      WINVER not defined. Defaulting to 0x0501 (Windows XP and Windows .NET Server)
      CDeviceFileParser.cpp
      c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\afxv_w32.h(18) : fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include <windows.h>
      CCommsManager.cpp
      WINVER not defined. Defaulting to 0x0501 (Windows XP and Windows .NET Server)

      C Offline
      C Offline
      Christoph Bail
      wrote on last edited by
      #2

      piul wrote:

      Compiling... snaplogger_main.cpp WINVER not defined. Defaulting to 0x0501 (Windows XP and Windows .NET Server)

      Not a real error, but only an information. [...]

      piul wrote:

      CDeviceFileParser.cpp c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\afxv_w32.h(18) : fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include

      Do you include Windows.h anywhere explicitly? How does the stdafx.h of your project look like? Where do you include afxtempl.h? Regards, Christoph

      P 1 Reply Last reply
      0
      • C Christoph Bail

        piul wrote:

        Compiling... snaplogger_main.cpp WINVER not defined. Defaulting to 0x0501 (Windows XP and Windows .NET Server)

        Not a real error, but only an information. [...]

        piul wrote:

        CDeviceFileParser.cpp c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\afxv_w32.h(18) : fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include

        Do you include Windows.h anywhere explicitly? How does the stdafx.h of your project look like? Where do you include afxtempl.h? Regards, Christoph

        P Offline
        P Offline
        piul
        wrote on last edited by
        #3

        I do not see any stdafx.h in my project. And no, I do not include Windows.h explicitly. afxtempl.h is included in CDeviceFileParser.h Any idea of why windows.h is being included? And why should this be a problem??

        C 1 Reply Last reply
        0
        • P piul

          I want to use the class CList for my project, but I get the following compiler error as soon as I do #include <afxtempl.h>

          Compiling...
          snaplogger_main.cpp
          WINVER not defined. Defaulting to 0x0501 (Windows XP and Windows .NET Server)
          CSnapLogger.cpp
          WINVER not defined. Defaulting to 0x0501 (Windows XP and Windows .NET Server)
          CDeviceFileParser.cpp
          c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\afxv_w32.h(18) : fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include <windows.h>
          CCommsManager.cpp
          WINVER not defined. Defaulting to 0x0501 (Windows XP and Windows .NET Server)

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          piul wrote:

          I want to use the class CList for my project, but I get the following compiler error as soon as I do #include

          Do you have an MFC-based project? If not, you might consider using one of the STL containers instead.

          "One man's wage rise is another man's price increase." - Harold Wilson

          "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

          "Man who follows car will be exhausted." - Confucius

          P 1 Reply Last reply
          0
          • P piul

            I do not see any stdafx.h in my project. And no, I do not include Windows.h explicitly. afxtempl.h is included in CDeviceFileParser.h Any idea of why windows.h is being included? And why should this be a problem??

            C Offline
            C Offline
            Christoph Bail
            wrote on last edited by
            #5

            What kind of application did you create? Is it a MFC application? Seems so since you intend to use afxtempl.h. Can you please check the the project settings? Regards, Christoph

            P 1 Reply Last reply
            0
            • C Christoph Bail

              What kind of application did you create? Is it a MFC application? Seems so since you intend to use afxtempl.h. Can you please check the the project settings? Regards, Christoph

              P Offline
              P Offline
              piul
              wrote on last edited by
              #6

              I am not very sure if it is a MFC application, I did not create it myself. Project properties says: Use of MFC : Use Standard Windows Libraries

              C 1 Reply Last reply
              0
              • D David Crow

                piul wrote:

                I want to use the class CList for my project, but I get the following compiler error as soon as I do #include

                Do you have an MFC-based project? If not, you might consider using one of the STL containers instead.

                "One man's wage rise is another man's price increase." - Harold Wilson

                "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                "Man who follows car will be exhausted." - Confucius

                P Offline
                P Offline
                piul
                wrote on last edited by
                #7

                I might be easier if I say what I want to do. I want to store in a variable a number of strings. The number of them will be variable and not known at the time of declaring the list/array/whatever. For what I have been reading I can do it with std::list, although I've never used it before.

                D 1 Reply Last reply
                0
                • P piul

                  I might be easier if I say what I want to do. I want to store in a variable a number of strings. The number of them will be variable and not known at the time of declaring the list/array/whatever. For what I have been reading I can do it with std::list, although I've never used it before.

                  D Offline
                  D Offline
                  David Crow
                  wrote on last edited by
                  #8

                  piul wrote:

                  For what I have been reading I can do it with std::list...

                  True, as well as std::vector.

                  "One man's wage rise is another man's price increase." - Harold Wilson

                  "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                  "Man who follows car will be exhausted." - Confucius

                  1 Reply Last reply
                  0
                  • P piul

                    I am not very sure if it is a MFC application, I did not create it myself. Project properties says: Use of MFC : Use Standard Windows Libraries

                    C Offline
                    C Offline
                    Christoph Bail
                    wrote on last edited by
                    #9

                    Maybe it would be the easiest way to create an empty MFC project and add the files of the Win32 project to that? Or simply try to change the "Use of MFC" to "Use MFC in a Static library" and rebuild. Don't know if this will work. Regards, Christoph

                    P 1 Reply Last reply
                    0
                    • C Christoph Bail

                      Maybe it would be the easiest way to create an empty MFC project and add the files of the Win32 project to that? Or simply try to change the "Use of MFC" to "Use MFC in a Static library" and rebuild. Don't know if this will work. Regards, Christoph

                      P Offline
                      P Offline
                      piul
                      wrote on last edited by
                      #10

                      Oh... I've just found a place where windows.h is included explicitly. What a mess!! I should start tidying all this up first of all... Thanks!

                      C 1 Reply Last reply
                      0
                      • P piul

                        Oh... I've just found a place where windows.h is included explicitly. What a mess!! I should start tidying all this up first of all... Thanks!

                        C Offline
                        C Offline
                        Christoph Bail
                        wrote on last edited by
                        #11

                        You're welcome. Regards, Christoph

                        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