Undefined symbol: register_all_cocos2dx_extension_manual

Undefined symbol: register_all_cocos2dx_extension_manual
0.0 0


Hi. I have a project which I generated for 2.1.5, just trying 2.2 now. I get this linker error when building the iOS project:

Undefined symbols for architecture i386:
  "register_all_cocos2dx_extension_manual(lua_State*)", referenced from:
      cocos2d::CCLuaStack::init() in CCLuaStack.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Do I have to regenerate the project files or anything like that?


OK after some digging, it seems like there are new files lua_cocos2dx_extensions_manual.cpp etc. that are in my Cocos2d-x-2.2 directory but do not appear in Xcode’s project navigator, even though it is indeed using Cocos2d-x-2.2 (I checked). There doesn’t seem to be an Eclipse-like refresh button. So presumably it’s not building the files because it doesn’t know they are there, and therefore not linking to them either. I guess I need to google more to find out how to tell Xcode to smarten up. Is this typical of iOS development? It seems bothersome.


Argh, closing/reopening either project (my game or the referenced cocos2dx project) or touch the directory does not seem to have any effect. Suggestions?


No ideas?

I’ve done all the tricks I could google for clearing Xcode’s caches.

Do I have to rebuild my project files? Can someone confirm this before I waste time trying?

Is this really what we have to do even for minor version upgrades? Seems like rather it should just somehow reuse stuff from Cocos2d-x itself, so would get proper updates.


Still no answer or even a hint?

OK so if I open my project.pbxproj file, I see this:

        46C1007916BF786A00F74D54 /* cocos2dx_support */ = {
            isa = PBXGroup;
            children = (
                1A9CE9171765A2C2000E3062 /* CCBProxy.cpp */,
                1A9CE9181765A2C2000E3062 /* CCBProxy.h */,
                46C1007A16BF786A00F74D54 /* CCLuaBridge.cpp */,
                46C1007B16BF786A00F74D54 /* CCLuaBridge.h */,
                46C1007C16BF786A00F74D54 /* CCLuaEngine.cpp */,
                46C1007D16BF786A00F74D54 /* CCLuaEngine.h */,
                46C1007E16BF786A00F74D54 /* CCLuaStack.cpp */,
                46C1007F16BF786A00F74D54 /* CCLuaStack.h */,
                46C1008016BF786A00F74D54 /* CCLuaValue.cpp */,
                46C1008116BF786A00F74D54 /* CCLuaValue.h */,
                46C1008216BF786A00F74D54 /* Cocos2dxLuaLoader.cpp */,
                46C1008316BF786A00F74D54 /* Cocos2dxLuaLoader.h */,
                1A9CE9191765A2C2000E3062 /* Lua_extensions_CCB.cpp */,
                1A9CE91A1765A2C2000E3062 /* Lua_extensions_CCB.h */,
                1A9CE91B1765A2C2000E3062 /* Lua_web_socket.cpp */,
                1A9CE91C1765A2C2000E3062 /* Lua_web_socket.h */,
                46C1008416BF786A00F74D54 /* LuaCocos2d.cpp */,
                46C1008516BF786A00F74D54 /* LuaCocos2d.h */,
                46C1008616BF786A00F74D54 /* platform */,
                46C1008A16BF786A00F74D54 /* tolua_fix.c */,
                46C1008B16BF786A00F74D54 /* tolua_fix.h */,
            path = cocos2dx_support;
            sourceTree = "";

That directory actually includes these files:


So clearly it’s not there in the project.

I am guessing it is because my project was generated for 2.1.5 (under cocos2d-x-2.1.5/projects/myproject) and I merely copied into 2.2 (as cocos2d-x-2.2/projects/myproject) so it doesn’t know about the new files.

However, I would have thought that the way it would work is myproject’s build files would have referenced cocos2dx build files (say under cocos2d-x-2.1.5/cocos2dx) and when I copied my project into the new location it would instead reference an updated cocos2dx build file (say under cocos2d-x-2.2/cocos2dx) because it would be a relative path.

After all, wouldn’t that be the reason the project generator scripts make them under cocos2d-x/projects in the first place, to use a relative path to reference the coco2dx build files? And wouldn’t requiring these projects to be regenerated everything you do a minor version upgrade be crazy?

Can someone please explain to me how the build system works? Because clearly my assumptions are fuzzy.


hi Marc,

I think you should add lua_cocos2dx_extensions_manual.cpp into your project.pbxproj.



So when we upgrade Cocos2d-x, we have to manually add all new files that result in unresolved symbols, to each project we are building? And remove any new files it cannot find? That seems awkward.


yes, does you have any other link errors after adding “lua_cocos2dx_extensions_manual.cpp” into your project.pbxproj. we can give the development team a feedback, maybe they have missed this file.


In the end what I did is I regenerated all the projects and just added back my couple of changes. After then flushing Xcode and the simulator and building from scratch, it’s running well. I think there should be a better way to handle upgrades, though… in some way, my project should reference a cocos2d-x project that is updated when I get the newer version. (I thought that was the whole point of generating the projects within the cocos2d-x folder, so they could reference a sibling cocos2d-x project upon which they depend.)