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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Error in Visual 2012 Running an MFC apps

Error in Visual 2012 Running an MFC apps

Scheduled Pinned Locked Moved C / C++ / MFC
c++csharpvisual-studioalgorithmshelp
4 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.
  • U Offline
    U Offline
    User 10414686
    wrote on last edited by
    #1

    I'm running an MFC apps in Visual 2012 for Genetic Algorithm Timetable.

    c:\users\zahrina\documents\visual studio 2012\projects\gaschedule\gaschedule\gaschedule.h(6): fatal error C1189: #error : "include 'stdafx.h' before including this file for PCH"
    main.cpp
    c:\users\zahrina\documents\visual studio 2012\projects\gaschedule\gaschedule\gaschedule.h(6): fatal error C1189: #error : "include 'stdafx.h' before including this file for PCH"
    GaScheduleDoc.cpp
    c:\users\zahrina\documents\visual studio 2012\projects\gaschedule\gaschedule\gaschedule.h(6): fatal error C1189: #error : "include 'stdafx.h' before including this file for PCH"
    GaSchedule.cpp
    c:\users\zahrina\documents\visual studio 2012\projects\gaschedule\gaschedule\gaschedule.h(6): fatal error C1189: #error : "include 'stdafx.h' before including this file for PCH"
    CourseClass.cpp

    Here is the coding for gaschedule.h

    // GaSchedule.h : main header file for the GaSchedule application
    //
    #pragma once

    #ifndef __AFXWIN_H__
    #error "include 'stdafx.h' before including this file for PCH"
    #endif

    #include "resource.h" // main symbols

    // CGaScheduleApp:
    // See GaSchedule.cpp for the implementation of this class
    //

    class CGaScheduleApp : public CWinApp
    {
    public:
    CGaScheduleApp();

    // Overrides
    public:
    virtual BOOL InitInstance();

    // Implementation

    public:
    afx_msg void OnAppAbout();
    DECLARE_MESSAGE_MAP()
    };

    extern CGaScheduleApp theApp;

    J 1 Reply Last reply
    0
    • U User 10414686

      I'm running an MFC apps in Visual 2012 for Genetic Algorithm Timetable.

      c:\users\zahrina\documents\visual studio 2012\projects\gaschedule\gaschedule\gaschedule.h(6): fatal error C1189: #error : "include 'stdafx.h' before including this file for PCH"
      main.cpp
      c:\users\zahrina\documents\visual studio 2012\projects\gaschedule\gaschedule\gaschedule.h(6): fatal error C1189: #error : "include 'stdafx.h' before including this file for PCH"
      GaScheduleDoc.cpp
      c:\users\zahrina\documents\visual studio 2012\projects\gaschedule\gaschedule\gaschedule.h(6): fatal error C1189: #error : "include 'stdafx.h' before including this file for PCH"
      GaSchedule.cpp
      c:\users\zahrina\documents\visual studio 2012\projects\gaschedule\gaschedule\gaschedule.h(6): fatal error C1189: #error : "include 'stdafx.h' before including this file for PCH"
      CourseClass.cpp

      Here is the coding for gaschedule.h

      // GaSchedule.h : main header file for the GaSchedule application
      //
      #pragma once

      #ifndef __AFXWIN_H__
      #error "include 'stdafx.h' before including this file for PCH"
      #endif

      #include "resource.h" // main symbols

      // CGaScheduleApp:
      // See GaSchedule.cpp for the implementation of this class
      //

      class CGaScheduleApp : public CWinApp
      {
      public:
      CGaScheduleApp();

      // Overrides
      public:
      virtual BOOL InitInstance();

      // Implementation

      public:
      afx_msg void OnAppAbout();
      DECLARE_MESSAGE_MAP()
      };

      extern CGaScheduleApp theApp;

      J Offline
      J Offline
      Jochen Arndt
      wrote on last edited by
      #2

      When using precompiled headers, you must include the file stdafx.h on top of all source files (*.cpp) before including other header files. When not using precompiled headers, comment or remove the __AFXWIN_H__ condition lines in the gaschedule.h file. Precompiled headers can be configured in the C/C++ section of your project settings.

      L U 2 Replies Last reply
      0
      • J Jochen Arndt

        When using precompiled headers, you must include the file stdafx.h on top of all source files (*.cpp) before including other header files. When not using precompiled headers, comment or remove the __AFXWIN_H__ condition lines in the gaschedule.h file. Precompiled headers can be configured in the C/C++ section of your project settings.

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        5+.

        1 Reply Last reply
        0
        • J Jochen Arndt

          When using precompiled headers, you must include the file stdafx.h on top of all source files (*.cpp) before including other header files. When not using precompiled headers, comment or remove the __AFXWIN_H__ condition lines in the gaschedule.h file. Precompiled headers can be configured in the C/C++ section of your project settings.

          U Offline
          U Offline
          User 10414686
          wrote on last edited by
          #4

          thank you very much. it helps me. :D

          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