cocos2d-x 新建项目 Cannot open include file: ‘cocos2d.h’

新建cocos2d-x 项目分这么几步。

1. 下载最新的cocos2d-x

2. 安装 vs2010

3. 解压cocos2d-x 压缩包,并双击”install-templates-msvc.bat”安装vs2010的cocos2d-x模版。先不要着急双击build-win32.bat

4. 打开vs2010 新建一个cocos2d-x项目

 

5. 假设我们新建的Project 叫HelloWorld, 在下一步中,Box2D是cocos2d-x的物理引擎,可以不勾选。 此时进行编译,会报Cannot open include file: ‘cocos2d.h’错误。不要着急。

6. 我们把刚刚解压缩的cocos2d-x中的,cocos2dx,CocosDenshion,external(如果你不用box2d就不用复制),这3个文件夹复制到我们的HelloWorld解决方案中,不是HelloWorld项目中。

 

不要放错位置了,

 

 

7. 准备把我们复制的3个项目添加到HelloWorld解决方案中。

右击解决方案选择添加,添加已存在Project。

 

 

 

记得选择这三个文件夹下的proj.win32文件夹下的cocos2d.vcxproj文件。

 

 

 

3个Project都添加好,类似这样的结构:

记得要把HelloWorld.win32右击设置为启动项目。

 

接下来先右击libcocos2d进行编译,再次是libCocosDenshion,最后是libBox2D。编译libcocos2d大约要5分钟时间,先刷下微博。

都编译好后,运行HelloWorld。

http://www.waitingfy.com/?p=573

573

2 Responses to cocos2d-x 新建项目 Cannot open include file: ‘cocos2d.h’

  1. Www.youtube.com说道:

    I’m now not certain the place you are getting your info, however good topic. I must spend a while finding out more or working out more. Thank you for magnificent information I used to be looking for this info for my mission.

  2. Kristine说道:

    Hey there! I simply would like to offer you a huge thumbs up for the excellent information you have right
    here on this post. I will be coming back to your website for more soon.

Leave a Reply

Name and Email Address are required fields.
Your email will not be published or shared with third parties.