"fatal error C1083: Cannot open include file: 'CCStdC.h': No such file or directory"

hey i want to develop an application for windows using cocos2dx.
i have done all the required setup.
after that i created a new project using cocos2dx.
till that everything works well but the moment when i build the project i get an error saying “fatal error C1083: Cannot open include file: ‘cocos2d.h’: No such file or directory”.

can anybody help me with this.
what is the solution for to solve this error.
it has pissed me off for the last 2 days.

kindly help me out with this.

thank you.

so do I!

The template doesn’t give the right include directories. Assuming that you created your project just under cocos2d-x root, it should look like this:

cocos2d-x root
|--MyProject
   |---proj.win32    <-- This is where the solution file is, and where $(SolutionDir) points

So to point to the include files, go to Project Properties>C/C++>General and replace Additional Include Directories with this:

.;…;$(SolutionDir)2dx;$(SolutionDir)2dx\include;$(SolutionDir)2dx\kazmath\include;$(SolutionDir)2dx\platform\win32;$(SolutionDir)2dx\platform\third_party\win32;$(SolutionDir)2dx\platform\third_party\win32\OGLES;$(SolutionDir);$(SolutionDir);%(AdditionalIncludeDirectories)

(NOTE: you may have to adjust it if you have Chipmunk or some other enabled modules, just add to the directory it gives you)

HTH

You will unfortunately need 2 more steps to make it work:

  1. Project Properties>Linker>General, add $(SolutionDir).win32 to the paths in Additional Library Directories (in the Debug config, Release.win32 in the Release config)

  2. Copy all of the DLLs in /Debug.win32 to MyProject/proj.win32/Debug.win32 (and same for Release)

  3. Profit!

And one more thing, if you enable Box2D, and wish to use CCPhysiscsSprite, add CC_ENABLE_BOX2D_INTEGRATION=1 as a preprocessor directive. Project Properties>C/C++>Preprocessor>^Preprocessor Definitions

Yet one more thing! :slight_smile:

If you want to use Box2D instead of Chipmunk, you need to go into the top-level solution (cocos2d-win32.vc201X.sln), and replace CC_ENABLE_CHIPMUNK_INTEGRATION to CC_ENABLE_BOX2D_INTEGRATION in the libExtensions project, and add that as an input library to your project.

Thanks Andagor you are a life saver :slight_smile:
This should be added to the wiki! Is Zhe listening?

Update
This is actually the wrong way to do it. We should not have to copy any dlls. We are creating the project in the wrong way. I wasted a day and half because of this “quick fix”.

Asloob Qureshi wrote:

This is actually the wrong way to do it. We should not have to copy any dlls. We are creating the project in the wrong way. I wasted a day and half because of this “quick fix”.

What is the correct way to create the project?

Open the visual studio solution for cocos2d-x. Add a new project to the same solution. After creating the project, open the project properties and add the libcocos2dx and libbox2d project references.

After adding the libcocos2dx and libbox2d project references I’m still getting the same errors. I do have all of the other projects in the solution unloaded though (libBox2D, libcocos2d, and my new proj are the only ones loaded). libchipmunk was giving me problems.

Is there something wrong with copying the dlls as in Andargor’s solution?

I got it working after I tried it again.

I’m not sure what it was, but I just redid everything including deleting VS 2012 Ultimate, deleting my cocos2d-x file and reinstalling both. Following Asloob’s project creation steps worked just fine and I didn’t get the fatal errors.

I’m facing the same issue after updating cocos2d-x ,anyway this can be fixed ?

in file main.h, add #include “platform/CCStdC.h”. it is OOKE

1 Like