Cocos2dx3.1.1的环境配置问题失败问题的解决

最近打算学习cocos2dx编程,但在环境配置中出了不少问题,这里对我遇到问题的解决办法记录一下,


我使用的开发工具为VS2012,下载最新版本的cocos2d-x-3.16后,一致编译不通过,后来发现问题是cocos2d-x-3.16不支持VS2012,要求更高版本的开发工具,因此只得作罢,最好在github上下载了旧版的cocos2d-x-3.1.1,下载地址为

https://github.com/cocos2d/cocos2d-x/tree/cocos2d-x-3.1.1


在打开cocos2d-x-3.1.1\build\cocos2d-win32.vc2012.sln时,还是出现了问题编译一直不成功,报错情况如下:

------ 已启动全部重新生成: 项目: libAudio, 配置: Debug Win32 ------
2>------ 已启动全部重新生成: 项目: libcocos2d, 配置: Debug Win32 ------
3>------ 已启动全部重新生成: 项目: libBox2D, 配置: Debug Win32 ------
4>------ 已启动全部重新生成: 项目: libchipmunk, 配置: Debug Win32 ------
2> ConvertUTF.c
2> ConvertUTFWrapper.cpp
2> edtaa3func.cpp
1> MciPlayer.cpp
1> SimpleAudioEngine.cpp
2>c1xx : fatal error C1083: 无法打开源文件:“....\external\edtaa3func\edtaa3func.cpp”: No such file or directory
2> tinyxml2.cpp
2> ioapi.cpp
2>c1xx : fatal error C1083: 无法打开源文件:“....\external\tinyxml2\tinyxml2.cpp”: No such file or directory
2>c1xx : fatal error C1083: 无法打开源文件:“....\external\unzip\ioapi.cpp”: No such file or directory
2> unzip.cpp
2>c1xx : fatal error C1083: 无法打开源文件:“....\external\unzip\unzip.cpp”: No such file or directory
3> b2BroadPhase.cpp
4> chipmunk.c
3> b2CollideCircle.cpp
2> xxhash.c
4> cpArbiter.c
2>c1xx : fatal error C1083: 无法打开源文件:“....\external\xxhash\xxhash.c”: No such file or directory
3> b2CollideEdge.cpp
3> b2CollidePolygon.cpp
2> CCMesh.cpp
2> CCObjLoader.cpp
4> cpArray.c
4> cpBB.c
2> CCSprite3D.cpp
2> CCSprite3DDataCache.cpp
2>F:\cocosX2d\cocos2d-x-cocos2d-x-3.1.1\cocos\platform\win32\CCGL.h(32): fatal error C1083: 无法打开包括文件:“GL/glew.h”: No such file or directory (..\3d\CCObjLoader.cpp)
2> atitc.cpp
2>F:\cocosX2d\cocos2d-x-cocos2d-x-3.1.1\cocos\platform\win32\CCGL.h(32): fatal error C1083: 无法打开包括文件:“GL/glew.h”: No such file or directory (..\3d\CCMesh.cpp)
2> base64.cpp
2> CCAutoreleasePool.cpp
2> ccCArray.cpp
2>F:\cocosX2d\cocos2d-x-cocos2d-x-3.1.1\cocos\platform\win32\CCGL.h(32): fatal error C1083: 无法打开包括文件:“GL/glew.h”: No such file or directory (..\3d\CCSprite3DDataCache.cpp)
2> CCConfiguration.cpp
2>F:\cocosX2d\cocos2d-x-cocos2d-x-3.1.1\cocos\platform\win32\CCGL.h(32): fatal error C1083: 无法打开包括文件:“GL/glew.h”: No such file or directory (..\base\CCConfiguration.cpp)
2> CCConsole.cpp
2>F:\cocosX2d\cocos2d-x-cocos2d-x-3.1.1\cocos\platform\win32\CCGL.h(32): fatal error C1083: 无法打开包括文件:“GL/glew.h”: No such file or directory (..\3d\CCSprite3D.cpp)
2> CCData.cpp
2>F:\cocosX2d\cocos2d-x-cocos2d-x-3.1.1\cocos\platform\win32\CCGL.h(32): fatal error C1083: 无法打开包括文件:“GL/glew.h”: No such file or directory (..\base\ccCArray.cpp)
2> CCDataVisitor.cpp
2> CCDirector.cpp
2>F:\cocosX2d\cocos2d-x-cocos2d-x-3.1.1\cocos\platform\win32\CCGL.h(32): fatal error C1083: 无法打开包括文件:“GL/glew.h”: No such file or directory (..\base\CCConsole.cpp)
2> CCEvent.cpp
2> CCEventAcceleration.cpp
2> CCEventCustom.cpp
2> CCEventDispatcher.cpp
2>F:\cocosX2d\cocos2d-x-cocos2d-x-3.1.1\cocos\platform\win32\CCGL.h(32): fatal error C1083: 无法打开包括文件:“GL/glew.h”: No such file or directory (..\base\CCDirector.cpp)
2> CCEventFocus.cpp
2>F:\cocosX2d\cocos2d-x-cocos2d-x-3.1.1\cocos\platform\win32\CCGL.h(32): fatal error C1083: 无法打开包括文件:“GL/glew.h”: No such file or directory (..\base\CCEventAcceleration.cpp)
2> CCEventKeyboard.cpp
2> CCEventListener.cpp
2> CCEventListenerAcceleration.cpp
2> CCEventListenerCustom.cpp
2>F:\cocosX2d\cocos2d-x-cocos2d-x-3.1.1\cocos\platform\win32\CCGL.h(32): fatal error C1083: 无法打开包括文件:“GL/glew.h”: No such file or directory (..\base\CCEventDispatcher.cpp)
2> CCEventListenerFocus.cpp
4> cpBBTree.c
3> b2Collision.cpp
2> CCEventListenerKeyboard.cpp
3> b2Distance.cpp
4> cpBody.c
3> b2DynamicTree.cpp
3> b2TimeOfImpact.cpp
4> cpCollision.c
2> CCEventListenerMouse.cpp
4> cpHashSet.c
2>F:\cocosX2d\cocos2d-x-cocos2d-x-3.1.1\cocos\platform\win32\CCGL.h(32): fatal error C1083: 无法打开包括文件:“GL/glew.h”: No such file or directory (..\base\CCEventListenerAcceleration.cpp)
2> CCEventListenerTouch.cpp
4> cpPolyShape.c
3> b2ChainShape.cpp
4> cpShape.c
2> CCEventMouse.cpp
2> CCEventTouch.cpp
2> ccFPSImages.c
2> CCIMEDispatcher.cpp
4> cpSpace.c
3> b2CircleShape.cpp
2> CCNS.cpp
3> b2EdgeShape.cpp
4> cpSpaceComponent.c
3> b2PolygonShape.cpp
4> cpSpaceHash.c
4> cpSpaceQuery.c
4> cpSpaceStep.c
2> CCProfiling.cpp
4> cpSpatialIndex.c
3> b2BlockAllocator.cpp
3> b2Draw.cpp
3> b2Math.cpp
4> cpSweep1D.c
4> cpVect.c
2> CCRef.cpp
2> CCScheduler.cpp
2> CCScriptSupport.cpp
2> CCTouch.cpp
2> ccTypes.cpp
3> b2Settings.cpp
2>F:\cocosX2d\cocos2d-x-cocos2d-x-3.1.1\cocos\platform\win32\CCGL.h(32): fatal error C1083: 无法打开包括文件:“GL/glew.h”: No such file or directory (..\base\CCScheduler.cpp)
2> CCUserDefault.cpp
2> CCUserDefaultAndroid.cpp
3> b2StackAllocator.cpp
4> cpConstraint.c
3> b2Timer.cpp
3> b2Body.cpp
4> cpDampedRotarySpring.c
2>F:\cocosX2d\cocos2d-x-cocos2d-x-3.1.1\cocos\platform\win32\CCGL.h(32): fatal error C1083: 无法打开包括文件:“GL/glew.h”: No such file or directory (..\base\CCTouch.cpp)
2> ccUTF8.cpp
3> b2ContactManager.cpp
3> b2Fixture.cpp
2> ccUtils.cpp
2> CCValue.cpp
2>F:\cocosX2d\cocos2d-x-cocos2d-x-3.1.1\cocos\platform\win32\CCGL.h(32): fatal error C1083: 无法打开包括文件:“GL/glew.h”: No such file or directory (..\base\ccTypes.cpp)
2> etc1.cpp
2> s3tc.cpp
4> cpDampedSpring.c
4> cpGearJoint.c
4> cpGrooveJoint.c
2> TGAlib.cpp
2>F:\cocosX2d\cocos2d-x-cocos2d-x-3.1.1\cocos\platform\win32\CCGL.h(32): fatal error C1083: 无法打开包括文件:“GL/glew.h”: No such file or directory (..\base\CCUserDefault.cpp)
2> ZipUtils.cpp
2>..\base\ZipUtils.cpp(25): fatal error C1083: 无法打开包括文件:“zlib.h”: No such file or directory
2> cocos2d.cpp
2> CCArray.cpp
2>..\base\ccUTF8.cpp(234): warning C4996: 'cocos2d::cc_wcslen': 被声明为已否决
2> f:\cocosx2d\cocos2d-x-cocos2d-x-3.1.1\cocos\base\ccUTF8.h(130) : 参见“cocos2d::cc_wcslen”的声明
2>..\base\ccUTF8.cpp(277): warning C4996: 'cocos2d::cc_wcslen': 被声明为已否决
2> f:\cocosx2d\cocos2d-x-cocos2d-x-3.1.1\cocos\base\ccUTF8.h(130) : 参见“cocos2d::cc_wcslen”的声明
2> CCDeprecated.cpp
2>F:\cocosX2d\cocos2d-x-cocos2d-x-3.1.1\cocos\platform\win32\CCGL.h(32): fatal error C1083: 无法打开包括文件:“GL/glew.h”: No such file or directory (..\base\TGAlib.cpp)
2> CCDictionary.cpp
2> CCNotificationCenter.cpp
2>F:\cocosX2d\cocos2d-x-cocos2d-x-3.1.1\cocos\platform\win32\CCGL.h(32): fatal error C1083: 无法打开包括文件:“GL/glew.h”: No such file or directory (..\deprecated\CCArray.cpp)
2> CCSet.cpp
2> CCString.cpp
3> b2Island.cpp
4> cpPinJoint.c
4> cpPivotJoint.c
4> cpRatchetJoint.c
3> b2World.cpp



这个问题在网上一直找不到原因,后来突发奇想是不是缺少了什么东西,于是再到github上找到该源代码

根据github上的使用帮助

Git user attention

  1. After cloning the repo, please execute download-deps.py to download and install some dependences.

      $ cd cocos2d-x
      $ python download-deps.py
    
  2. Please execute download-deps.py once you synchronize with this repo. If there aren't any updates, it will not download dependences again.

找到了  cocos2d-x-3.1.1目录下的 download-deps.py文件,点击运行后,自动下载项目运行所需要的依赖文件

然后再运行cocos2d-x-3.1.1\build\cocos2d-win32.vc2012.sln

然后就成功了

Cocos2dx3.1.1的环境配置问题失败问题的解决_第1张图片

你可能感兴趣的:(C++)