Unexpected precompiled header

Putmalk

Deity
Joined
Sep 26, 2010
Messages
2,652
Location
New York
Hey. I created a new class in the game source. However when I try to compile, I get "unexpected precompiled header error", simply rerunning the compiler might fix this problem (it doesn't).

Tried clean -> build, doesn't fix.

How would I fix this? Thank you. I'm sure I have to edit the CvGameCoreDLL_Expansion2Wind32Mod.pch somehow to add my class in, but I don't know how to do that.

Any help would be appreciated.



I'm also very nervous to do something via google in the fear of breaking the DLL since this is very delicate. In the past I've modified existing classes, now I'm looking to add to the DLL.
 
I think it is because the DLL wants to have a reference to all header files (I assume you added a CvClassName.h header as part of your class) in the CvGameCoreDLLPCH.h file. Just add an #include directive at the end of that (right before the "using namespace fastdelegate" line) and it should work.
 
I think it is because the DLL wants to have a reference to all header files (I assume you added a CvClassName.h header as part of your class) in the CvGameCoreDLLPCH.h file. Just add an #include directive at the end of that (right before the "using namespace fastdelegate" line) and it should work.

I do have a include in there with the correct class name.
 
Every now and again my build does that, I just run clean, exit VS-2010, restart and rebuild - usually fixes it
 
Every now and again my build does that, I just run clean, exit VS-2010, restart and rebuild - usually fixes it

Okay, thanks. Thank took care of the compile issues.

I got scared like they wouldn't let us put a new class into the DLL.... :twitch:
 
Tested in game. My database is loading fine (whether or not it's being accepted into the C++ I don't know, I have to test that), but my custom class isn't producing any errors and the game isn't crashing.

Thanks for the help guys.
 
The entire options system in my DLL uses a custom class to load values from the DB and cache them in memory - no problems there.
 
The entire options system in my DLL uses a custom class to load values from the DB and cache them in memory - no problems there.

Mhmm. I have no problems on my end either. Everything is smooth sailing.
 
Reviving this thread because the error message came up in my search. I'm trying to compile unmodded dll (expansion 2) for the first time. Followed steps 1 - 11 in the "How to compile dll" page. Got a page full of the error below. Same thing when I tried the other two dlls.
Spoiler :
Code:
1>------ Build started: Project: CvGameCoreDLL_Expansion2, Configuration: Mod Win32 ------
1>Compiling...
1>cl : Command line warning D9040 : ignoring option '/analyze'; Code Analysis warnings are not available in this edition of the compiler
1>_precompile.cpp
1>Compiling...
1>cl : Command line warning D9040 : ignoring option '/analyze'; Code Analysis warnings are not available in this edition of the compiler
1>CvLuaUnit.cpp
1>.\Lua\CvLuaUnit.cpp(9) : fatal error C1859: 'C:\Users\Pazyryk\Documents\Visual Studio 2008\Projects\CvGameCoreSource\\BuildTemp\VS2008_CvGameCoreDLL_Expansion2ModWin32\\CvGameCore_Expansion2.pch' unexpected precompiled header error, simply rerunning the compiler might fix this problem
1>CvLuaTeamTech.cpp
1>.\Lua\CvLuaTeamTech.cpp(15) : fatal error C1859: 'C:\Users\Pazyryk\Documents\Visual Studio 2008\Projects\CvGameCoreSource\\BuildTemp\VS2008_CvGameCoreDLL_Expansion2ModWin32\\CvGameCore_Expansion2.pch' unexpected precompiled header error, simply rerunning the compiler might fix this problem
1>CvLuaTeam.cpp
1>.\Lua\CvLuaTeam.cpp(15) : fatal error C1859: 'C:\Users\Pazyryk\Documents\Visual Studio 2008\Projects\CvGameCoreSource\\BuildTemp\VS2008_CvGameCoreDLL_Expansion2ModWin32\\CvGameCore_Expansion2.pch' unexpected precompiled header error, simply rerunning the compiler might fix this problem
1>CvLuaSupport.cpp
1>.\Lua\CvLuaSupport.cpp(15) : fatal error C1859: 'C:\Users\Pazyryk\Documents\Visual Studio 2008\Projects\CvGameCoreSource\\BuildTemp\VS2008_CvGameCoreDLL_Expansion2ModWin32\\CvGameCore_Expansion2.pch' unexpected precompiled header error, simply rerunning the compiler might fix this problem
1>CvLuaPlot.cpp
1>.\Lua\CvLuaPlot.cpp(15) : fatal error C1859: 'C:\Users\Pazyryk\Documents\Visual Studio 2008\Projects\CvGameCoreSource\\BuildTemp\VS2008_CvGameCoreDLL_Expansion2ModWin32\\CvGameCore_Expansion2.pch' unexpected precompiled header error, simply rerunning the compiler might fix this problem
1>CvLuaPlayer.cpp
1>.\Lua\CvLuaPlayer.cpp(15) : fatal error C1859: 'C:\Users\Pazyryk\Documents\Visual Studio 2008\Projects\CvGameCoreSource\\BuildTemp\VS2008_CvGameCoreDLL_Expansion2ModWin32\\CvGameCore_Expansion2.pch' unexpected precompiled header error, simply rerunning the compiler might fix this problem
1>CvLuaMap.cpp
1>.\Lua\CvLuaMap.cpp(15) : fatal error C1859: 'C:\Users\Pazyryk\Documents\Visual Studio 2008\Projects\CvGameCoreSource\\BuildTemp\VS2008_CvGameCoreDLL_Expansion2ModWin32\\CvGameCore_Expansion2.pch' unexpected precompiled header error, simply rerunning the compiler might fix this problem
1>CvLuaLeague.cpp
1>.\Lua\CvLuaLeague.cpp(9) : fatal error C1859: 'C:\Users\Pazyryk\Documents\Visual Studio 2008\Projects\CvGameCoreSource\\BuildTemp\VS2008_CvGameCoreDLL_Expansion2ModWin32\\CvGameCore_Expansion2.pch' unexpected precompiled header error, simply rerunning the compiler might fix this problem
1>CvLuaGameInfo.cpp
1>.\Lua\CvLuaGameInfo.cpp(15) : fatal error C1859: 'C:\Users\Pazyryk\Documents\Visual Studio 2008\Projects\CvGameCoreSource\\BuildTemp\VS2008_CvGameCoreDLL_Expansion2ModWin32\\CvGameCore_Expansion2.pch' unexpected precompiled header error, simply rerunning the compiler might fix this problem
1>CvLuaGame.cpp
1>.\Lua\CvLuaGame.cpp(16) : fatal error C1859: 'C:\Users\Pazyryk\Documents\Visual Studio 2008\Projects\CvGameCoreSource\\BuildTemp\VS2008_CvGameCoreDLL_Expansion2ModWin32\\CvGameCore_Expansion2.pch' unexpected precompiled header error, simply rerunning the compiler might fix this problem
1>CvLuaFractal.cpp
1>.\Lua\CvLuaFractal.cpp(9) : fatal error C1859: 'C:\Users\Pazyryk\Documents\Visual Studio 2008\Projects\CvGameCoreSource\\BuildTemp\VS2008_CvGameCoreDLL_Expansion2ModWin32\\CvGameCore_Expansion2.pch' unexpected precompiled header error, simply rerunning the compiler might fix this problem
1>CvLuaEnums.cpp
1>.\Lua\CvLuaEnums.cpp(15) : fatal error C1859: 'C:\Users\Pazyryk\Documents\Visual Studio 2008\Projects\CvGameCoreSource\\BuildTemp\VS2008_CvGameCoreDLL_Expansion2ModWin32\\CvGameCore_Expansion2.pch' unexpected precompiled header error, simply rerunning the compiler might fix this problem
1>CvLuaDeal.cpp
1>.\Lua\CvLuaDeal.cpp(9) : fatal error C1859: 'C:\Users\Pazyryk\Documents\Visual Studio 2008\Projects\CvGameCoreSource\\BuildTemp\VS2008_CvGameCoreDLL_Expansion2ModWin32\\CvGameCore_Expansion2.pch' unexpected precompiled header error, simply rerunning the compiler might fix this problem
1>CvLuaCity.cpp
1>.\Lua\CvLuaCity.cpp(9) : fatal error C1859: 'C:\Users\Pazyryk\Documents\Visual Studio 2008\Projects\CvGameCoreSource\\BuildTemp\VS2008_CvGameCoreDLL_Expansion2ModWin32\\CvGameCore_Expansion2.pch' unexpected precompiled header error, simply rerunning the compiler might fix this problem
1>CvLuaArgsHandle.cpp
1>.\Lua\CvLuaArgsHandle.cpp(16) : fatal error C1859: 'C:\Users\Pazyryk\Documents\Visual Studio 2008\Projects\CvGameCoreSource\\BuildTemp\VS2008_CvGameCoreDLL_Expansion2ModWin32\\CvGameCore_Expansion2.pch' unexpected precompiled header error, simply rerunning the compiler might fix this problem



< snip >



2008\Projects\CvGameCoreSource\\BuildTemp\VS2008_CvGameCoreDLL_Expansion2ModWin32\\CvGameCore_Expansion2.pch' unexpected precompiled header error, simply rerunning the compiler might fix this problem
1>CvBeliefClasses.cpp
1>.\CvBeliefClasses.cpp(8) : fatal error C1859: 'C:\Users\Pazyryk\Documents\Visual Studio 2008\Projects\CvGameCoreSource\\BuildTemp\VS2008_CvGameCoreDLL_Expansion2ModWin32\\CvGameCore_Expansion2.pch' unexpected precompiled header error, simply rerunning the compiler might fix this problem
1>CvBarbarians.cpp
1>.\CvBarbarians.cpp(9) : fatal error C1859: 'C:\Users\Pazyryk\Documents\Visual Studio 2008\Projects\CvGameCoreSource\\BuildTemp\VS2008_CvGameCoreDLL_Expansion2ModWin32\\CvGameCore_Expansion2.pch' unexpected precompiled header error, simply rerunning the compiler might fix this problem
1>CvAStar.cpp
1>.\CvAStar.cpp(17) : fatal error C1859: 'C:\Users\Pazyryk\Documents\Visual Studio 2008\Projects\CvGameCoreSource\\BuildTemp\VS2008_CvGameCoreDLL_Expansion2ModWin32\\CvGameCore_Expansion2.pch' unexpected precompiled header error, simply rerunning the compiler might fix this problem
1>CvArmyAI.cpp
1>.\CvArmyAI.cpp(9) : fatal error C1859: 'C:\Users\Pazyryk\Documents\Visual Studio 2008\Projects\CvGameCoreSource\\BuildTemp\VS2008_CvGameCoreDLL_Expansion2ModWin32\\CvGameCore_Expansion2.pch' unexpected precompiled header error, simply rerunning the compiler might fix this problem
1>CvArea.cpp
1>.\CvArea.cpp(9) : fatal error C1859: 'C:\Users\Pazyryk\Documents\Visual Studio 2008\Projects\CvGameCoreSource\\BuildTemp\VS2008_CvGameCoreDLL_Expansion2ModWin32\\CvGameCore_Expansion2.pch' unexpected precompiled header error, simply rerunning the compiler might fix this problem
1>CvAIOperation.cpp
1>.\CvAIOperation.cpp(9) : fatal error C1859: 'C:\Users\Pazyryk\Documents\Visual Studio 2008\Projects\CvGameCoreSource\\BuildTemp\VS2008_CvGameCoreDLL_Expansion2ModWin32\\CvGameCore_Expansion2.pch' unexpected precompiled header error, simply rerunning the compiler might fix this problem
1>CvAdvisorRecommender.cpp
1>.\CvAdvisorRecommender.cpp(8) : fatal error C1859: 'C:\Users\Pazyryk\Documents\Visual Studio 2008\Projects\CvGameCoreSource\\BuildTemp\VS2008_CvGameCoreDLL_Expansion2ModWin32\\CvGameCore_Expansion2.pch' unexpected precompiled header error, simply rerunning the compiler might fix this problem
1>CvAdvisorCounsel.cpp
1>.\CvAdvisorCounsel.cpp(8) : fatal error C1859: 'C:\Users\Pazyryk\Documents\Visual Studio 2008\Projects\CvGameCoreSource\\BuildTemp\VS2008_CvGameCoreDLL_Expansion2ModWin32\\CvGameCore_Expansion2.pch' unexpected precompiled header error, simply rerunning the compiler might fix this problem
1>CvAchievementUnlocker.cpp
1>.\CvAchievementUnlocker.cpp(16) : fatal error C1859: 'C:\Users\Pazyryk\Documents\Visual Studio 2008\Projects\CvGameCoreSource\\BuildTemp\VS2008_CvGameCoreDLL_Expansion2ModWin32\\CvGameCore_Expansion2.pch' unexpected precompiled header error, simply rerunning the compiler might fix this problem
1>Generating Code...
1>Build log was saved at "file://C:\Users\Pazyryk\Documents\Visual Studio 2008\Projects\CvGameCoreSource\BuildTemp\VS2008_CvGameCoreDLL_Expansion2ModWin32\BuildLog.htm"
1>CvGameCoreDLL_Expansion2 - 160 error(s), 2 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Tried a second time and got a shorter list:
Spoiler :
Code:
1>------ Build started: Project: CvGameCoreDLL_Expansion2, Configuration: Mod Win32 ------
1>Compiling...
1>cl : Command line warning D9040 : ignoring option '/analyze'; Code Analysis warnings are not available in this edition of the compiler
1>_precompile.cpp
1>.\_precompile.cpp(1) : fatal error C1859: 'C:\Users\Pazyryk\Documents\Visual Studio 2008\Projects\CvGameCoreSource\\BuildTemp\VS2008_CvGameCoreDLL_Expansion2ModWin32\\CvGameCore_Expansion2.pch' unexpected precompiled header error, simply rerunning the compiler might fix this problem
1>Build log was saved at "file://C:\Users\Pazyryk\Documents\Visual Studio 2008\Projects\CvGameCoreSource\BuildTemp\VS2008_CvGameCoreDLL_Expansion2ModWin32\BuildLog.htm"
1>CvGameCoreDLL_Expansion2 - 1 error(s), 1 warning(s)


========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Additional builds didn't change after that.
Every now and again my build does that, I just run clean, exit VS-2010, restart and rebuild - usually fixes it
Tried this (except it's VS-2008). It just went back to the long error list. And then the shorter list when I ran it again.

Appreciate any tips... (looking forward to modding dll so I can stop building my Rube Goldberg Lua hacks)
 
Well..., Google is your best friend in these situations. Apparently there is a nasty incompatibility between VS-2008 and Windows 7. Should be fixed in VS-2010.

Just a question before I install another VS. Is there any reason for me to install VS-2010 rather than VS-2012? The expansion2 dll (which is the only one I will ever mod) has solution files for 08, 10 and 12.
 
Just a question before I install another VS. Is there any reason for me to install VS-2010 rather than VS-2012? The expansion2 dll (which is the only one I will ever mod) has solution files for 08, 10 and 12.

Post #99 and #100 in the DLL thread imply that it should work, but there is no follow up from anyone to say that it actually did (but conversely there is no rant to say it didn't ;) )
 
I suppose this will apply also for VS-2012:
If you want to use VS-2010 to build the DLL (which I was) you need to install VS-2008 FIRST and then VS-2010 (installing VS-2008 after VS-2010 because you forgot to do it doesn't seem to work!)
I'll report back in the DLL thread if this works out...
 
Every now and again my build does that, I just run clean, exit VS-2010, restart and rebuild - usually fixes it

This problem still happens occasionally with VS Community 2015, and whoward69's solution still works!
 
Back
Top Bottom