I figured the following out the hard way, because I didn't know what resource to look at. What should I have read?
I used aptitude to install the c++ library package libexample5.3 and libexample5.3-dev
libexample.so.5.3) in /usr/lib/example.h) in /usr/include/To link libexample into test.cpp, compile with:
g++ -o test test.cpp -lexample
But first all the entities linked to must be declared:
#include <example.h> //contains declarations of everything provided by libexample
int main() {
return example::CONSTANT_2;
}
For the libexample/libexample-dev stuff, the position of shared libraries and the like see the Debian policy manual; for the working of the -l flag, see the g++ manpage; for the fact that you have to #include some header to use a library, that's usual practice, but it's usually documented anyway in the library documentation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With