Code Monkey home page Code Monkey logo

lua-in-cpp's Issues

Ubuntu 18.04 with C++17 and gcc --version gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 fails

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");

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.