Precompiled Header Issues

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Precompiled Header Issues

      Hi, I`ve modified the directory structure to one that I like better :

      Source Code

      1. DEV - ASSETS
      2. - DOCS
      3. - EXTRA
      4. - GAME
      5. - WIN32
      6. - X64
      7. - SOURCE
      8. - CORE
      9. - EDITOR
      10. - GAME
      11. - LIB
      12. - MSVC
      13. - CORELIB
      14. - EDITOR
      15. - GAME
      16. - TEMP
      Display All


      Basically I want to move all msvc projects in one place instead of having them spread in the source files. I want the core,editor and game folders to contain only h/cpp files. I`ve created a new project CoreLIB and setup the directories accordingly but I get an annoying error message when I try to use the precompiled header. The project is setup to use the precompiled header for all platforms and configurations except for the CoreStd.cpp file which is setup to create the CoreStd.pch file.

      The error I get is :

      C:\Program Files\Microsoft Visual Studio 10.0\VC\include\xlocnum(133): error C2857: '#include' statement specified with the /YcCodeStd.h command-line option was not found in the source file

      Other times I get the same error for a different file : memory.
      I`ve played with the project settings to try figure out why it does this but I can`t find what I`m doing wrong. I`m comparing my project`s options with your project options (GameCode4_2010) and oddly enough yours is working just fine :).

      CoreStd.h/cpp are located in Dev/Source/MSVC/CoreLIB/and corestd.cpp includes corestd.h at the top of the file.

      Please help!
      Thanks

      The post was edited 1 time, last by ColdFire ().

    • I just realized that no one answered this post! Sorry about that! Did you ever get this resolved? Mike set up the directory structure and precompiled header stuff for GCC so he's probably the one who weigh in here. I've never used them personally.

      -Rez
    • I had a lot of issues when I first started using PCH's as well. Basically, the PCH is compiled separatly from everything else. So you have two option's to do this, either you manually compile the PCH, or (like GCC) you set the project settings up to do it for you each time you compile. You can manually compile it by right clicking on CodeStd.cpp and selecting the "compile" option on the menu.

      Below i'll explain how GCC4 sets up it's PCH, since you are trying to use it that way.

      There are actually 2 setting sheets that you need to modify to set this up. One is the overall project settings, and the other is the PCH's settings.

      First go into the project settings, go to the pre-compiled header section, and set it to "use" your PCH CodeStd. I'm guessing, if you going off of GCC4's settings then you already have this portion set up.

      Second, go to the PCH files setting panel by right click on the CodeStd.cpp (or CodeStd.h, I forget) file and selecting properties. You'll get a settings panel similar to the project settings panel. Find the PCH section, and here set it up the same as the project settings, except tell it to "Create" the PCH.

      That should fix your issue.
    • Hey guys, thanks for your replies. I haven`t found the answer to the problem I have and I will either go without precompiled headers or modify GCC`s source code project and hope it won`t be too much trouble.

      As I said in my first post I was using the "/Yu (Use)" option for the entire project except for the corestd.cpp file that was suppose to create the .pch with the "/Yc (create)" option. I tried to compile corestd.cpp first separately but I get the same error.

      As an ending to this post I want to congratulate Mike and Rez for GCC4. It`s a well written book and a good reference to start with.
    • I think I might have an idea - the error you mentioned above where the #incldude file was not found, I believe to be caused if you fail to #include the precompiled header file as the very first line of each and every file that uses precompiled headers.

      You'll see that in GCC4 source that #include "GameCodeStd.h" everywhere in the project that creates the GameCode4_2010.lib.

      For the GCC4EditorDLL_2010 project and the TeapotWars_2010 project there is a little more trickery. They use/create their own precompiled headers, GCC4EditorStd.h and TeapotWarsStd.h. But, the first line in each of those files is #include "GameCodeStd.h", which basically includes all the stuff the basic game engine needs.

      This way you get crazy fast compiles, but only if you aren't changing the core engine much.

      I hope that helps!
      Mr.Mike
      Author, Programmer, Brewer, Patriot
    • I`ve just manually checked every .cpp file in the project that uses the precompiled header to have "#include CoreStd.h" as the very first line and they do :) .

      I don`t have much time these days for programming so I won`t be bothering myself with this problem. I`ll just redo the project as soon as I get enough time.

      10x for your help though! ;)