Hello,

I have a fairly basic question about compiling libraries. Suppose that I want to use an open-source library that has been written by somebody else. Typically, when I go to the website to download it, then instead of being provided with the library files themselves, I am provided with the source files, with instructions on how to compile it myself.

Why is this? Why can't the author just provide me with the library files and header files, so I can just plug them straight into my project? I understand that having a look at the source files themselves is nice, but is this the only reason?

If I am building a project in Visual Studio, then why am I told to compile the code using that compiler, rather than another one? Surely the executable at the end will be the same as on another compiler, because the code is the same?

Also, typically, there are different source files for Windows and Linux. I understand that some functions may use the operating system API, but for a lot of projects, only the standard C++ library is used. Hence, can't the same source files be used for both operating systems?

I know this is probably basic stuff, but I could do with getting it straight before I move on!

Thanks.