Link error in "hellow world" application (cocos2d-x + qt) Help

Link error in "hellow world" application (cocos2d-x + qt) Help
0.0 0


1>AppDelegate.obj : error LNK2001: unresolved external symbol “public: virtual bool __thiscall cocos2d::CCEGLView::Create(unsigned short const *,int,int)” (?Create@CCEGLView@cocos2d@UAE_NPBGHHZ)
1>…win32\cocos3.exe : fatal error LNK1120: 1 unresolved externals
1>Build log was saved at “file://C:3\Debug\BuildLog.htm”
1>cocos3 - 2 error(s), 0 warning(s)
Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped

I created Qt application. Then added necessary settings to the project (include directories, additional dependencies, library directories like in template “cocos2d-win32 Application”). Also added source, header and resource files of “Hello world” but main.cpp:

#include "main.h"
#include "AppDelegate.h"

#include "cocos3.h"

int main(int argc, char *argv[])            // Created by Qt
    QApplication a(argc, argv);
    cocos3 w;;

    AppDelegate app;                                                  // Copied from Hellow world
    cocos2d::CCApplication::sharedApplication().run();     //

    return a.exec();

I don’t know what main function should I write: from cocos2d-x application or that was created by Qt. Could you help me with error and main function?


that was because “Unicode” is defined in libs and in my project is not


I am experiencing the same issue - building cocos without unicode support in VisualStudio fails so I have to build with unicode enabled, and UNICODE and _UNICODE is defined in my qt project.
What did you do exactly to fix the issue?



Exactly I did the same (defined UNICODE and _UNICODE). Also I added /Zc:wchar_t to C/C++Line\Additional options. After that сompilation was successful.


I created a widget that displays cocos2d-x. It also supports mouse clicks (it repaints after click). I know that it is a bad way but I had to change two files of the library (added one function to .h and .cpp). I could’t solve the problem by inheriting. If anyone is interested I can share code.


Hi Max,
sharing your code would be great!

You mentioned adding /Zc:wchar_t to C/C++Line\Additional options - but that is for VisualStudio right?
I do not have any problems building the cocos library from VisualStudio 2010, but when linking the library from my Qt application I get the linker error you have mentioned in your first post, although UNICODE and _UNICODE are defined.