Skip to content
This repository has been archived by the owner on Nov 28, 2022. It is now read-only.

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

Open
LazyPlanet opened this issue Jan 10, 2019 · 1 comment
Open

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

LazyPlanet opened this issue Jan 10, 2019 · 1 comment

Comments

@LazyPlanet
Copy link

想在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
Copy link
Author

正常执行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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant