Configuring cocos2d-x application with visual studio 2010 project template

I am trying to configure an application on Windows 7 using Cocos2D-x.

I followed this tutorial .

I have done the following:

  • A library was built with the launch of the Build-win32.bat script. Work.
  • Installed project template VS2010. Work.
  • Run all test programs.
  • Created a new cocos2D-x project through an installed template. Work

When I compile the Hello World application, I get the following errors:

error C1083: impossible to open inclusion file 'CCstdC.h' No such file or directory error C1083: impossible to open inclusion file 'cocos2d.h' No such file or directory 

Incorrect include path.

I could fix this by manually changing the include path, but since I am creating a project through the Id template to solve this problem, it may not be necessary to manually change the paths for each new project.

Has anyone had the same problem? Do you know how to fix this?

+4
source share
3 answers

I decided to open the cocos2dx library solution and add a new project to it using the VS Template Wizard.

+2
source

Well, I am setting up cocos2dx projects as follows:

  • create empty win32 application in VS
  • open the folder containing your .sln file (the folder with your solution)
  • open cocos2dx package (i.e. cocos2d-1.0.1-x-0.12.0.zip) with 7z or something
  • drag cocos2dx and possibly CocosDenshion, Box2D etc. to the folder with your solution.
  • add cocos2dx project (cocos2dx \ proj.win32 \ cocos2d-win32.vcxproj) to your solution
  • go to the properties of your project, select C / C ++ → General, add the following data to your additional directory directory:

    .. \ cocos2dx; .. \ cocos2dx \ include; .. \ cocos2dx \ platform; .. \ cocos2dx \ platform \ win32; .. \ cocos2dx \ platform \ THIRD_PARTY \ win32 \ OGLES

and .. \ CocosDenshion \ include if you are using SimpleAudioEngine

  • in the option Linker-> Input-> Additional Dependencies, add libcocos2d.lib and libCocosDenshion.lib if you use a sound engine; in the option Linker-> General-> Additional Library Directories, add $ (OutDir)

  • go to Configuration Properties → General → Output Directory, set it to $ (SolutionDir) \ build \

  • open the project property for the cocos2d library, go to Configuration Configuration → General-> Output Directory, set it to $ (SolutionDir) \ build \, and also do this for the other libraries that you included.

Everything is set, you are ready to work.

+5
source

Unfortunately, this template is not so useful. I believe that in the previous version of cocos2d-x (based on the tutorial), the paths were absolute and directly referenced the cocos2dx , cocosdenshion .

Now, since they are relative ( ..\..\cocos2dx ), and they are not copied to the solution catalog when creating the project, this simply does not work.

Obviously, you could fix the paths (as you said), but my suggestion is to copy the HelloWorld project and use it as a template. The structure of the solution is much better than that in the template, as it is already prepared for iOS, win32 and Android. Believe me, it could not be easier.

Now, here's the catch: if you copy the HelloWorld project to the sibling folder, you are done, since all the links are already configured. If you want to copy to another location, you also need to copy cocos2dx , cocosdenshion , leaving the target structure as follows:

 target_path\cocos2dx target_path\cocosdenshion target_path\Copy_of_Hello_World 
+2
source

All Articles