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. Question about "stdafx.h"

Question about "stdafx.h"

Scheduled Pinned Locked Moved C / C++ / MFC
c++questiontoolshelplearning
6 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.
  • A Offline
    A Offline
    akirilov
    wrote on last edited by
    #1

    Hi guys, I downloaded a zip utility source code. When I used it in my program I received:

    ..\Zip_Utils\zip.cpp(2992) : fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source?

    I have the source. Of course, I can easily add '#include "stdafx.h"', but that is not the point. The question is: what is so special of "stdafx.h" that require including it in every .cpp that I add??? P.S. I don't know does it matter, but I'm writing in VS2005 in C++ for Windows Mobile 5.0, native, without STL, WTL, MFC.

    D M 2 Replies Last reply
    0
    • A akirilov

      Hi guys, I downloaded a zip utility source code. When I used it in my program I received:

      ..\Zip_Utils\zip.cpp(2992) : fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source?

      I have the source. Of course, I can easily add '#include "stdafx.h"', but that is not the point. The question is: what is so special of "stdafx.h" that require including it in every .cpp that I add??? P.S. I don't know does it matter, but I'm writing in VS2005 in C++ for Windows Mobile 5.0, native, without STL, WTL, MFC.

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

      akirilov wrote:

      The question is: what is so special of "stdafx.h" that require including it in every .cpp that I add???

      Because it's the key to using the precompiled header (.pch) file. The bigger question is how was the project's author able to compile the project without making the changes you've had to?

      "Love people and use things, not love things and use people." - Unknown

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

      A 1 Reply Last reply
      0
      • D David Crow

        akirilov wrote:

        The question is: what is so special of "stdafx.h" that require including it in every .cpp that I add???

        Because it's the key to using the precompiled header (.pch) file. The bigger question is how was the project's author able to compile the project without making the changes you've had to?

        "Love people and use things, not love things and use people." - Unknown

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

        A Offline
        A Offline
        akirilov
        wrote on last edited by
        #3

        Because it's the key to using the precompiled header (.pch) file. So I have to include "stdafx.h" in every .cpp that I'm using? Than probably I have to start reading about precompiled header (.pch) file...

        D 1 Reply Last reply
        0
        • A akirilov

          Because it's the key to using the precompiled header (.pch) file. So I have to include "stdafx.h" in every .cpp that I'm using? Than probably I have to start reading about precompiled header (.pch) file...

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

          akirilov wrote:

          So I have to include "stdafx.h" in every .cpp that I'm using?

          Yes, if that's the way the project has been configured. You can, however, turn it off for individual files (e.g., C files).

          "Love people and use things, not love things and use people." - 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
          • A akirilov

            Hi guys, I downloaded a zip utility source code. When I used it in my program I received:

            ..\Zip_Utils\zip.cpp(2992) : fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source?

            I have the source. Of course, I can easily add '#include "stdafx.h"', but that is not the point. The question is: what is so special of "stdafx.h" that require including it in every .cpp that I add??? P.S. I don't know does it matter, but I'm writing in VS2005 in C++ for Windows Mobile 5.0, native, without STL, WTL, MFC.

            M Offline
            M Offline
            Michael Dunn
            wrote on last edited by
            #5

            See the FAQ: 2.5 I added some source files I got from someone else into my project and the compiler gives the error "C1010: unexpected end of file while looking for precompiled header directive." Why? [^]

            --Mike-- Visual C++ MVP :cool: LINKS~! CP SearchBar v3.0 | C++ Forum FAQ "That's what's great about doing user interface work. No matter what you do, people will say that what you did was idiotic." -- Raymond Chen

            A 1 Reply Last reply
            0
            • M Michael Dunn

              See the FAQ: 2.5 I added some source files I got from someone else into my project and the compiler gives the error "C1010: unexpected end of file while looking for precompiled header directive." Why? [^]

              --Mike-- Visual C++ MVP :cool: LINKS~! CP SearchBar v3.0 | C++ Forum FAQ "That's what's great about doing user interface work. No matter what you do, people will say that what you did was idiotic." -- Raymond Chen

              A Offline
              A Offline
              akirilov
              wrote on last edited by
              #6

              Thank you, that was very helpful!!!

              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