Building a C++ project with the Lua source code
Building your C++ project with the Lua source code has the benefit that it is always compiled as part of your project, and there is no possibility of any surprises arising from compiler incompatibilities.
The major difference from linking with a pre-compiled Lua library is that we will now compile the Lua library from its source code first. It is also better to use the source code package without modifying it or copying only a few selected files into a new folder hierarchy. This will help in the future if you need to use a newer Lua version. In such a case, all you will need to do is to replace the Lua source code folder with the new version.
Creating a project to work with the Lua source code
To create a project using the Lua source code, we need to go back to the Lua source code package:
lua-5.4.6 % ls Makefile README doc src
You will need the src
subfolder.
Create a folder for a new project. Within it, create an empty...