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. ATL / WTL / STL
  4. VS skips $include "stdafx.h"

VS skips $include "stdafx.h"

Scheduled Pinned Locked Moved ATL / WTL / STL
c++visual-studiohelpworkspacecsharp
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.
  • B Offline
    B Offline
    bkelly13
    wrote on last edited by
    #1

    Windows XP, Visual Studio 2008, MFC, Cpp Note: I am hoping that someone recognizes this basic class of problems and can advise me without additional details. If needed, tell me what additional details are required. I cannot copy/paste from my working computer so please excuse any obvious typos. Basic Problem: I added a simple stand alone function to my project and cannot get Visual Studio to compile it. Setup: Application AR2_IADS_Client_Simlulator is located in E:\VISUAL_STUDIO\AR2_IADS_Client_Simulator. This directory: E:\VISUAL_STUDIO\COMMON_CODE contains classes and code that is used by multiple solutions and projects. In the Solution Explorer, project AR2_IADS_Client_Simulator I right clicked on the Header Files part of the project and added a new dot h file named: Log_One_TCP_Packet.h. It was placed in the COMMON_CODE directory. It looks like this:

    #include “stdafx.h”
    #include “C_Log_Writer.h”
    Void Log_One_TCP_Packet( … arguments );

    The same was done in section Source Files and file Log_One_TCP_Packet.h.cpp was also created in COMMON_CODE. It begins like this:

    #include “stdafx.h”
    #include “Log_One_TCP_Packet.h”
    Void Log_One_TCP_Packet( … arguments )
    { … }

    Action: The cpp file is open in VS and is in focus. Press ctl-F7 to compile it. The error messages state:

    Quote:

    Warning C4627 #include “stdafx.h” skipped when looking for precompiled header use. Warning C4627 #include “Log_One_TCP_Packet.h” skipped when looking for precompiled header use. Fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add ‘#include “stdafx.h”’ to your soruce?

    I don’t know of any option such as: #include_and_do_not_skip “Log_One_TCP_Packet.h” There is no button I can select that says: “No! I did not forget. Its right there in the source code.” There are already several classes in COMMON_CODE used by this project. The directory is referenced in

    Quote:

    Properties -> Configuration Properties -> C/C++ -> Additional Include Directories.

    Questions Must this function be made into a stand-alone class just for this one function? How might I get VS to recognize and compile it?

    Thank you for your time If you work with telemetry, please check this bulletin board: www.irigbb.com

    Richard Andrew x64R P 2 Replies Last reply
    0
    • B bkelly13

      Windows XP, Visual Studio 2008, MFC, Cpp Note: I am hoping that someone recognizes this basic class of problems and can advise me without additional details. If needed, tell me what additional details are required. I cannot copy/paste from my working computer so please excuse any obvious typos. Basic Problem: I added a simple stand alone function to my project and cannot get Visual Studio to compile it. Setup: Application AR2_IADS_Client_Simlulator is located in E:\VISUAL_STUDIO\AR2_IADS_Client_Simulator. This directory: E:\VISUAL_STUDIO\COMMON_CODE contains classes and code that is used by multiple solutions and projects. In the Solution Explorer, project AR2_IADS_Client_Simulator I right clicked on the Header Files part of the project and added a new dot h file named: Log_One_TCP_Packet.h. It was placed in the COMMON_CODE directory. It looks like this:

      #include “stdafx.h”
      #include “C_Log_Writer.h”
      Void Log_One_TCP_Packet( … arguments );

      The same was done in section Source Files and file Log_One_TCP_Packet.h.cpp was also created in COMMON_CODE. It begins like this:

      #include “stdafx.h”
      #include “Log_One_TCP_Packet.h”
      Void Log_One_TCP_Packet( … arguments )
      { … }

      Action: The cpp file is open in VS and is in focus. Press ctl-F7 to compile it. The error messages state:

      Quote:

      Warning C4627 #include “stdafx.h” skipped when looking for precompiled header use. Warning C4627 #include “Log_One_TCP_Packet.h” skipped when looking for precompiled header use. Fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add ‘#include “stdafx.h”’ to your soruce?

      I don’t know of any option such as: #include_and_do_not_skip “Log_One_TCP_Packet.h” There is no button I can select that says: “No! I did not forget. Its right there in the source code.” There are already several classes in COMMON_CODE used by this project. The directory is referenced in

      Quote:

      Properties -> Configuration Properties -> C/C++ -> Additional Include Directories.

      Questions Must this function be made into a stand-alone class just for this one function? How might I get VS to recognize and compile it?

      Thank you for your time If you work with telemetry, please check this bulletin board: www.irigbb.com

      Richard Andrew x64R Offline
      Richard Andrew x64R Offline
      Richard Andrew x64
      wrote on last edited by
      #2

      Did you try cleaning and rebuilding the whole project?

      The difficult we do right away... ...the impossible takes slightly longer.

      B 1 Reply Last reply
      0
      • Richard Andrew x64R Richard Andrew x64

        Did you try cleaning and rebuilding the whole project?

        The difficult we do right away... ...the impossible takes slightly longer.

        B Offline
        B Offline
        bkelly13
        wrote on last edited by
        #3

        Rats. Its so easy to forget the easy stuff. No, I did not. I will try that at work tomorrow. But I did make a class out of it and that worked just fine.

        Thank you for your time If you work with telemetry, please check this bulletin board: www.irigbb.com

        1 Reply Last reply
        0
        • B bkelly13

          Windows XP, Visual Studio 2008, MFC, Cpp Note: I am hoping that someone recognizes this basic class of problems and can advise me without additional details. If needed, tell me what additional details are required. I cannot copy/paste from my working computer so please excuse any obvious typos. Basic Problem: I added a simple stand alone function to my project and cannot get Visual Studio to compile it. Setup: Application AR2_IADS_Client_Simlulator is located in E:\VISUAL_STUDIO\AR2_IADS_Client_Simulator. This directory: E:\VISUAL_STUDIO\COMMON_CODE contains classes and code that is used by multiple solutions and projects. In the Solution Explorer, project AR2_IADS_Client_Simulator I right clicked on the Header Files part of the project and added a new dot h file named: Log_One_TCP_Packet.h. It was placed in the COMMON_CODE directory. It looks like this:

          #include “stdafx.h”
          #include “C_Log_Writer.h”
          Void Log_One_TCP_Packet( … arguments );

          The same was done in section Source Files and file Log_One_TCP_Packet.h.cpp was also created in COMMON_CODE. It begins like this:

          #include “stdafx.h”
          #include “Log_One_TCP_Packet.h”
          Void Log_One_TCP_Packet( … arguments )
          { … }

          Action: The cpp file is open in VS and is in focus. Press ctl-F7 to compile it. The error messages state:

          Quote:

          Warning C4627 #include “stdafx.h” skipped when looking for precompiled header use. Warning C4627 #include “Log_One_TCP_Packet.h” skipped when looking for precompiled header use. Fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add ‘#include “stdafx.h”’ to your soruce?

          I don’t know of any option such as: #include_and_do_not_skip “Log_One_TCP_Packet.h” There is no button I can select that says: “No! I did not forget. Its right there in the source code.” There are already several classes in COMMON_CODE used by this project. The directory is referenced in

          Quote:

          Properties -> Configuration Properties -> C/C++ -> Additional Include Directories.

          Questions Must this function be made into a stand-alone class just for this one function? How might I get VS to recognize and compile it?

          Thank you for your time If you work with telemetry, please check this bulletin board: www.irigbb.com

          P Offline
          P Offline
          peterchen
          wrote on last edited by
          #4

          IIRC you get this - or at least a similar - chain of warnings/errors when your first include does not match the precompiled header setting for the file. Check that the precompiled header setting for this file actually is "stdafx.h", not another one.

          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