Lua 5.3 undefined references

前端 未结 2 1804
不思量自难忘°
不思量自难忘° 2021-01-13 13:08

I am trying to learn how to embed lua in a C program, but I am not great at reading technical documents, and I haven\'t found any current tutorials. This is my program:

相关标签:
2条回答
  • 2021-01-13 13:55

    In c++ you should include lua.hpp not lua.h. lua.h does not define the extern "C" block to stop the name mangling of the c++ compiler.

    0 讨论(0)
  • 2021-01-13 13:56

    The arguments for g++ had -llua before the input file. I put -llua at the end, and everything works fine now.

    0 讨论(0)
提交回复
热议问题