Search code examples
c++open-sourcelibraries

How are Open Source libraries' codes structured and how can I use the library without installing it?


I git cloned the source code for a open source library called opencv. Now suppose I want to modify the source code of the library (adding new functions or improving the existing ones). My question is how can see what is its effect on the library? One way could be to make it make install it again and then link the newly installed library to my project and compile it to get an executable. Is there a shorter method?

Most of the libraries in c++ seem to structured in a very similar way, which compels me to think that the answer to this is inherently related to their structure. Could please also point out some resources where I can learn about the ideology behind the structure?

Thanks


Solution

  • It's not particular to Open Source.

    Basically, you're not going to avoid make and link. Compiling and linking are necessary to produce an executable. (Script languages don't need this, they do the same at runtime).

    make install might be avoided. This copies the newly created library in a standard place, so library users can easily find it. It also avoids a possible problem where a failed build breaks the installed good build. But in your case, you can link your test program against the library in its build directory.