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. fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include <windows.h></windows.h> [modified]

fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include <windows.h></windows.h> [modified]

Scheduled Pinned Locked Moved C / C++ / MFC
c++databasehelpquestion
8 Posts 5 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.
  • K Offline
    K Offline
    Kiran Pinjala
    wrote on last edited by
    #1

    I have a non MFC project with couple of .h and .cpp files. Now i wnat to add a class CDbOperations to that project temporarily which will handle the database interatctions. I have used CDatabase, CString, CSemaphore classes in CDbOperations class. I have added required includes as

    #include <afxdb.h>
    #include <afxmt.h>

    int my CDbOperations.h file. When i compile the project i got this error

    fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include <windows.h>

    How can i solve this error.

    Saadhinchaali

    modified on Wednesday, February 4, 2009 2:13 AM

    S _ D 3 Replies Last reply
    0
    • K Kiran Pinjala

      I have a non MFC project with couple of .h and .cpp files. Now i wnat to add a class CDbOperations to that project temporarily which will handle the database interatctions. I have used CDatabase, CString, CSemaphore classes in CDbOperations class. I have added required includes as

      #include <afxdb.h>
      #include <afxmt.h>

      int my CDbOperations.h file. When i compile the project i got this error

      fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include <windows.h>

      How can i solve this error.

      Saadhinchaali

      modified on Wednesday, February 4, 2009 2:13 AM

      S Offline
      S Offline
      SandipG
      wrote on last edited by
      #2

      Tritva wrote:

      I have a non MFC project with couple of .h and .cpp files.

      Tritva wrote:

      I have used CDatabase, CString, CSemaphore classes in CDbOperations class.

      Your app is no longer non MFC app. Classes you mentioned above are from MFC.

      Regards, Sandip.

      K 1 Reply Last reply
      0
      • K Kiran Pinjala

        I have a non MFC project with couple of .h and .cpp files. Now i wnat to add a class CDbOperations to that project temporarily which will handle the database interatctions. I have used CDatabase, CString, CSemaphore classes in CDbOperations class. I have added required includes as

        #include <afxdb.h>
        #include <afxmt.h>

        int my CDbOperations.h file. When i compile the project i got this error

        fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include <windows.h>

        How can i solve this error.

        Saadhinchaali

        modified on Wednesday, February 4, 2009 2:13 AM

        _ Offline
        _ Offline
        _Superman_
        wrote on last edited by
        #3

        Try removing #include <windows.h> from your code.

        «_Superman_»

        K 1 Reply Last reply
        0
        • S SandipG

          Tritva wrote:

          I have a non MFC project with couple of .h and .cpp files.

          Tritva wrote:

          I have used CDatabase, CString, CSemaphore classes in CDbOperations class.

          Your app is no longer non MFC app. Classes you mentioned above are from MFC.

          Regards, Sandip.

          K Offline
          K Offline
          Kiran Pinjala
          wrote on last edited by
          #4

          Hi Sandip,

          SandipG wrote:

          Your app is no longer non MFC app.

          Yes. you are right. But before using that classes, i was developing a non mfc project. Since i needed a dabase interatction i used those classes. Now it has become an mfc project. Is there a way to getrid of that error?

          Saadhinchaali

          1 Reply Last reply
          0
          • _ _Superman_

            Try removing #include <windows.h> from your code.

            «_Superman_»

            K Offline
            K Offline
            Kiran Pinjala
            wrote on last edited by
            #5

            Hi, Thank you for the reply. I have not added the line #include <windows.h> any where in my application.

            Saadhinchaali

            S 1 Reply Last reply
            0
            • K Kiran Pinjala

              Hi, Thank you for the reply. I have not added the line #include <windows.h> any where in my application.

              Saadhinchaali

              S Offline
              S Offline
              Smith
              wrote on last edited by
              #6

              add stdafx.h on top of everything in the source file where it points the error.

              :beer:

              K 1 Reply Last reply
              0
              • S Smith

                add stdafx.h on top of everything in the source file where it points the error.

                :beer:

                K Offline
                K Offline
                Kiran Pinjala
                wrote on last edited by
                #7

                Hi Smith, I dont have a stdafx.h file in my project. I have created an empty console application and created my .h and .cpp files later.

                Saadhinchaali

                1 Reply Last reply
                0
                • K Kiran Pinjala

                  I have a non MFC project with couple of .h and .cpp files. Now i wnat to add a class CDbOperations to that project temporarily which will handle the database interatctions. I have used CDatabase, CString, CSemaphore classes in CDbOperations class. I have added required includes as

                  #include <afxdb.h>
                  #include <afxmt.h>

                  int my CDbOperations.h file. When i compile the project i got this error

                  fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include <windows.h>

                  How can i solve this error.

                  Saadhinchaali

                  modified on Wednesday, February 4, 2009 2:13 AM

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

                  Where are you including afxwin.h at?

                  "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

                  "The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch

                  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