pbc icon indicating copy to clipboard operation
pbc copied to clipboard

C++调用LUA报错:undefined symbol: lua_checkstack

Open LazyPlanet opened this issue 6 years ago • 1 comments

想在C++调用lua的相关代码,lua里面调用了pbc的相关内容,使用了老板的test.lua作为测试: extern "C" { #include "lua.h" #include "lualib.h" #include "lauxlib.h" };

#include #include

int main() { lua_State* __L = luaL_newstate();

    luaL_openlibs(__L);

    int rst = luaL_dofile(__L, "./test.lua");
    std::string value = lua_tostring(__L, -1);
    std::cout << rst << std::endl;
    std::cout << value << std::endl;

}

g++ test_lua.cpp -I /export/game/MX-MMO/lua/include /export/game/MX-MMO/lua/lib/liblua64.a -ldl

[game@VM_109_84_centos script]$ ./a.out 1

error loading module 'protobuf.c' from file './protobuf.so':

    ./protobuf.so: undefined symbol: lua_checkstack

需要怎么调用呢,谢谢老板!

LazyPlanet avatar Jan 10 '19 07:01 LazyPlanet

正常执行test.lua没有问题: [game@VM_109_84_centos script]$ lua test.lua test/addressbook.proto tutorial Profile nick_name [1] LABEL_OPTIONAL icon [2] LABEL_OPTIONAL Person name [1] LABEL_REQUIRED id [2] LABEL_REQUIRED email [3] LABEL_OPTIONAL phone [4] LABEL_REPEATED test [5] LABEL_REPEATED profile [6] LABEL_OPTIONAL Ext AddressBook person [1] LABEL_REPEATED Alice 12345 1301234567 HOME 87654321 WORK Alice 123 table: 0x1760be0

LazyPlanet avatar Jan 10 '19 07:01 LazyPlanet