volpi-m / lua-in-cpp Goto Github PK
View Code? Open in Web Editor NEWAn easy to use library to call lua functions from C++ and vice versa
License: Other
An easy to use library to call lua functions from C++ and vice versa
License: Other
I compiled this project with Ubuntu 18.04, had to downgrade to C++17. The makefile failed (src/main.o: In function main': main.cpp:(.text+0x9c): undefined reference to
Lua::Lua()'), but this command worked:
g++ -fPIC -shared -W -Wall -Wextra --std=c++17 -I/home/savage2/libdir/lua/lua-5.4.4/src/ -L/home/savage2/libdir/lua/lua-5.4.4/src/ BaseFunction.cpp Lua.cpp LuaFunction.cpp NonVoidFunction.cpp VoidFunction.cpp main.cpp -o libluaincpp.so
When I try test.lua and the main programm from the readme it fails.
g++ main.cpp -I ../src/ -I ../../../lua/lua-5.4.4/src/ -L../src/ -L../../../lua/lua-5.4.4/src/ -llua -lluaincpp -fpermissive
main.cpp: In function 'int main()':
main.cpp:14:32: error: no matching function for call to 'add(const char [4], int (*)(int, int), const char [7])'
l.add("add", &add, "mymath");
^
In file included from ../src/LuaInCpp.hpp:3:0,
from main.cpp:1:
../src/Lua.hpp:27:10: note: candidate: void Lua::add(const string&, lua_CFunction, const string&) <near match>
void add(const std::string &, lua_CFunction, const std::string & = "");
^~~
../src/Lua.hpp:27:10: note: conversion of argument 2 would be ill-formed:
main.cpp:14:18: warning: invalid conversion from 'int (*)(int, int)' to 'lua_CFunction {aka int (*)(lua_State*)}' [-fpermissive]
l.add("add", &add, "mymath");
^~~~
In file included from ../src/LuaInCpp.hpp:3:0,
from main.cpp:1:
../src/Lua.hpp:29:10: note: candidate: void Lua::add(const string&, lua_Integer, const string&) <near match>
void add(const std::string &, lua_Integer, const std::string & = "");
^~~
../src/Lua.hpp:29:10: note: conversion of argument 2 would be ill-formed:
main.cpp:14:18: warning: invalid conversion from 'int (*)(int, int)' to 'lua_Integer {aka long long int}' [-fpermissive]
l.add("add", &add, "mymath");
^~~~
In file included from ../src/LuaInCpp.hpp:3:0,
from main.cpp:1:
../src/Lua.hpp:31:10: note: candidate: void Lua::add(const string&, void*, const string&) <near match>
void add(const std::string &, void *, const std::string & = "");
^~~
../src/Lua.hpp:31:10: note: conversion of argument 2 would be ill-formed:
main.cpp:14:18: warning: invalid conversion from 'int (*)(int, int)' to 'void*' [-fpermissive]
l.add("add", &add, "mymath");
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.