qcdong2016 / MiniExcel

Mini Excel Reader(just .xlsx) for C++ & Lua
18 stars 13 forks source link

Lua: undefined symol: luaopen_miniexcel #3

Open bacTlink opened 8 years ago

bacTlink commented 8 years ago

I am using CentOS7 and Lua5.1.4 was initially installed. Perhaps for this reason, CMake fails to find Lua. I remove if (BUILD_LUA) and find_package(Lua51 REQUIRED), and replace the ${LUA_INCLUDE_DIR} as my local path.

Then I just

mkdir build
cd build
cmake ..
cmake --build .

Compile Error. I have to add -std=c++11 option, and add some head file including "string" and "stdio.h", then the commands work well and I get a .so file libminiexcel.so. After that, I copy the file test.lua into /build, and run lua test.lua, and it report a failure: Can't find miniexcel. So I modify 'libminiexcel.so' as 'miniexcel.so', then the lua program complains that

lua: error loading module 'miniexcel' from file 'miniexcel.so':
    ./miniexcel.so: undefined symol: luaopen_miniexcel

How to fix this? Thanks in advance.

qcdong2016 commented 8 years ago

I think I fixed. Retry please.

bacTlink commented 8 years ago

It looks good now though still lacking some head files. I suggest adding #include<cstring> to test.cpp and LuaMiniExcel.cpp.