coco2d-x 3.0 alpha1 添加 #include "CocosGUI.h" 头文件时出现链接错误

coco2d-x 3.0 alpha1 添加 #include "CocosGUI.h" 头文件时出现链接错误

开发环境: win8.1 vs2012  coco2d-x 3.0 alpha1

现在想在 新建的工程里添加:
UILayer* layer = UILayer::create();
UIButton* uiButton = UIButton::create();
等控件时,引入的头文件和命名空间是:
#include "CocosGUI.h"
using namespace gui;
出现链接错误是:
1>HelloWorldScene.obj : error LNK2019: unresolved external symbol "public: __thiscall gui::UIMargin::UIMargin(void)" (??0UIMargin@gui@@QAE@XZ) referenced in function "void __cdecl gui::`dynamic initializer for 'UIMarginZero''(void)" (??__EUIMarginZero@gui@@YAXXZ)
1>HelloWorldScene.obj : error LNK2019: unresolved external symbol "public: static class gui::UIButton * __cdecl gui::UIButton::create(void)" (?create@UIButton@gui@@SAPAV12@XZ) referenced in function "public: virtual bool __thiscall HelloWorld::init(void)" (?init@HelloWorld@@UAE_NXZ)
1>HelloWorldScene.obj : error LNK2019: unresolved external symbol "public: static class gui::UILayer * __cdecl gui::UILayer::create(void)" (?create@UILayer@gui@@SAPAV12@XZ) referenced in function "public: virtual bool __thiscall HelloWorld::init(void)" (?init@HelloWorld@@UAE_NXZ)
1>D:\cocos2d-x 3.0\cocos2d-x-3.0alpha1\projects\Cocos2d-x3.0_3\proj.win32\Debug.win32\MyGame.exe : fatal error LNK1120: 3 unresolved externals
========== Build: 0 succeeded, 1 failed, 3 up-to-date, 0 skipped ========== 

///////////////////////////////////////// 解决方法 /////////////////////////////////////////////////////////////////////////////////////////////////////
设置 
[c/c++ -> Generel -> Additional Include Directories ->]
$(EngineRoot)
$(EngineRoot)cocos\
$(EngineRoot)cocos\gui

Linker 设置
[Linker->General->Additional Library Directories]
$(EngineRoot)build\Debug.win32
如果是release 需要设置release相应的目录

链接中却少相应的 lib库
[Linker->Input->Additional Dependencies]
libGUI.lib
libCocosStudio.lib
libExtensions.lib

设置相应的头文件及命名空间
#include "CocosGUI.h"

USING_NS_CC;
using namespace gui;


注意:在新版中 extensions/CCControl 系列不再维护了。
而是使用重新设计新的GUI框架,在cocos/gui下面。

你可能感兴趣的:(coco2d-x 3.0 alpha1 添加 #include "CocosGUI.h" 头文件时出现链接错误)