question about using the compiled program of external libraries

advertisements

I know this might be a very stupid question but I am new to compiled languages (my domain is mostly scripting languages like PHP, Python or JavaScript).

I am learning C++ for one project where it is the only language I can use.

I wrote a program in Ubuntu 10.10 and then compiled it. I can run the generated binary file from cmd like this and it works:

sudo ./compiled-program

But, I have used some external libraries in the program (OpenCV). Does that mean that all computers where I will run the program will have to have OpenCV installed? Or is OpenCV bundled inside the compiled binary file? Will it work on PCs without OpenCV installed?


You should read a few things about libraries, and particularly what makes the difference between static and dynamic libraries. To quote the basic definitions so you get the point :

A static library, also known as an archive, consists of a set of routines which are copied into a target application by the compiler, linker, or binder, producing object files and a stand-alone executable file.

[...]

Dynamic linking involves loading the subroutines of a library (which may be referred to as a DLL, especially under Windows, or as a DSO (dynamic shared object) under Unix-like systems) into an application program at load time or runtime, rather than linking them in at compile time.