Hi, I’m running windows 7, using VS 2013, and am fairly inexperienced with C++. I am trying to run lua from my game, and as a result have been troubleshooting this error for the past few hours now:
Error 3 error LNK2019: unresolved external symbol "__declspec(dllimport) public: static class cocos2d::LuaEngine * __cdecl cocos2d::LuaEngine::getInstance(void)" (__imp_?getInstance@LuaEngine@cocos2d@@SAPAV12@XZ) referenced in function "public: virtual bool __thiscall AppDelegate::applicationDidFinishLaunching(void)" (?applicationDidFinishLaunching@AppDelegate@@UAE_NXZ) C:\Users\Kirb\Documents\Cocos\CocosProjects\LuaTestCPP\proj.win32\AppDelegate.obj LuaTestCPP
I’m trying to use LuaEngine in a fresh C++ precompiled library cocos2d-x-3.10 studio project, with the only changes being in the AppDelegate.cpp file.
#includeCCLuaEngine.h added to top of file, and lines
auto scene = HelloWorld::createScene();
plus
director->runWithScene(scene)
commented out.
The apparent cause of the issue is adding this line
LuaEngine* luaEngine = LuaEngine::getInstance();
right above
auto director = Director::getInstance();.
as commenting it out stops the error from occuring.
I also have some additional include directories:
C:\Cocos\Cocos2d-x\cocos2d-x-3.10\cocos\scripting\lua-bindings
C:\Cocos\Cocos2d-x\cocos2d-x-3.10\cocos\scripting\lua-bindings\manual
C:\Cocos\Cocos2d-x\cocos2d-x-3.10\cocos\scripting\lua-bindings\auto
C:\Cocos\Cocos2d-x\cocos2d-x-3.10\external\lua\lua
C:\Cocos\Cocos2d-x\cocos2d-x-3.10\external\lua\tolua
If anyone has an idea on how to resolve this, please share!