Static linking error when compiling myGame in Cocos2d-x v3.6

810 views Asked by At

I'm using Cocos2d-x v3.6 for win32 desktop, Visual studio 2013 and C++.

There are many errors appeared When compiling my project, and these errors because of the linker unable to linking between my project and cocos2d-x library files .lib, although I have set all settings correctly.

The picture in its large size: Show me.

Firstly, the following is the folder that has the library .lib files:

Secondly, the visual studio settings that I added:

Now, What is the reason behind these errors.

1

There are 1 answers

1
KompjoeFriek On BEST ANSWER

You need to get rid of the dllimport and dllexport parts. See cocos\platform\win32\CCPlatformDefine-win32.h:

#if defined(CC_STATIC)
    #define CC_DLL
#else
#if defined(_USRDLL)
    #define CC_DLL     __declspec(dllexport)
#else         /* use a DLL library */
    #define CC_DLL     __declspec(dllimport)
#endif
#endif

To do that, just add CC_STATIC to the preprocessor definitions of your cocos2d-x library project, and the project linking with it.