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:
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.
lua.hpp
lua.h
extern "C"
The arguments for g++ had -llua before the input file. I put -llua at the end, and everything works fine now.