Has anyone accomplished to use precompiled headers in *c/*cpp files of cocos engine?
I could make it work only in my own files but not with cocos. I did something wrong or it is not possible?
Thanks.
Has anyone accomplished to use precompiled headers in *c/*cpp files of cocos engine?
I could make it work only in my own files but not with cocos. I did something wrong or it is not possible?
Thanks.
What are you trying?
I create a stdafx.h and stdafx.cpp,
I push #include “stdafx.h” in c/cpp files of cocos engine and in stdafx.cpp
Set the value “Use (/Yu)” for the “Precompiled Header” option (cocos files c/cpp)
Set the value “Create(/Yu)” for the “Precompiled Header” option (stdafx.cpp)
but then I have errors from cocos files like this:
unexpected end of file while looking for precompiled header. Did you forget to add ‘#include “stdafx.h”’ to your source? C:\Users…cocos2d\cocos\editor-support\spine\Animation.c 838
error LNK1181: cannot open input file ‘libSpine.lib’ C:…\cocos2d\cocos\2d\LINK
the header “Animation.c” starts out that way :
#include "../Classes/stdafx.h"
#include <spine/Animation.h>
#include <spine/IkConstraint.h>
#include <limits.h>
#include <spine/extension.h>
spAnimation* spAnimation_create (const char* name, int timelinesCount) { ........
I want to do this because I am losing a lot of time compiling.
With my own classes there are no mistakes
Use the Cocos2d-x prebuilt libraries.
oh thanks you, I hadn’t heard about this.
Actually those are two different things, fyi. Precompiled headers essentially just do all the header pre-processing once instead of every compile. It is worse compile times if you change anything in the headers being pre-compiled often.
I currently am using precompiled headers, but am not using prebuilt libraries just yet until I can iron out the workflow of engine upgrades.
Prebuilt libraries if you get them working with Windows and Visual Studio will probably save you the most time since it won’t have to compile the 400-1000 files for the engine code.
The issue I think you’re having is that you probably only want to try and precompile your own game header files. I’m sure you could get it to work for the engine library as well, but you’d probably need to set that up separately. Maybe your stdafx.h file is just not visible from the cocos2d-x library project?
I’d start by just getting your game’s headers to precompile first.
@stevetranby Maybe your stdafx.h file is just not visible from the cocos2d-x library project?
mmm yes, probably this is the problem, I will try this weekend, thank you.
indeed
I guess I just read “I want to compile faster” and didn’t stop to think OP might want to modify source too, etc.