Does anyone know what is the correct way to install a C++ library and if any special configuration is required in the other files folders inside the application (I mean apart from modifying the main.cpp file, it is required to modify another one)?
How to install a library in c++ properly?
Best reply by nickH
Hi Josaphat_Diaz,Â
There is not an easy answer to your question, which would fully answer it. I would recommend you to learn more about C++ in general. There is good literature and also videos you can find online. This would be something you learn in a course about C++ in university for example.
But I attached a little example for you. In this example I edited the hello.world example from the ctrlX Automation SDK and instead for printing out directly something to the logbook I used my self-created shared library (libSharedLibrary.so). Some things you need to do, so it will work:
- link the library in the CMakeLists
- include the header (interface description of the library) in your main.cpp
- include the library in your snap (so it is available at runtime)
- possibly change the environment variable LD_LIBRARY_PATH (see also this post in the community)
Best regards,Â
Nick
Â
2 replies