Why do you need to compile libraries?

When I tried to use Lua with just the source files, it would not work. I can't remember the issue from before, but the issue was solved after I built the library by following some instructions. I would like to know why it is necessary to build a library before using it.
Because computers do not understand source code, they understand binary instructions. "Translators" are important.
Reading this article should help
http://www.linuxjournal.com/content/examining-compilation-process-part-1
Thank you for your reply kevinkjt2000,
I understand that computers cannot understand source code, but the compiler should be able to. I am wondering why I have to convert the Lua source into a static library (.lib) before I am allowed to use it for my programs. Why can't I just include the Lua source code inside of my program directory and build it all at once? Using both the Lua source code and my program's source code. Not the Lua static library and my source code.
Well Lua compilers and C++ compilers are two seperate things. I am sure you will agree Lua and C++ are entirely different languages. Maybe you are wanting to embed Lua instead?
I found a tutorial on how to do that here:
http://cc.byexamples.com/2008/06/07/how-to-embed-lua-51-in-c/
If you just throw a whole bunch of ingredients together into a baking dish and put it in the oven, you won't get a cake out. You'll get a bunch of burnt ingredients.

Why didn't it work? Because you did it wrong.

Bake according to instructions.




Everything the computer does, and the way it works, follows rules. And the rules change depending on what you are doing. Follow the rules in effect and things will work right. Lua was designed to compile as a library.
Topic archived. No new replies allowed.