简体   繁体   中英

Put shared library file in C++ project

I'm looking to use an .so library in a C++ project of mine. I have the header file for it and the actual .so has to be somewhere as well; I installed them using apt-get.

Since my project is under version management and I don't want everyone who downloads the repository to have to install the packages I installed, I would like to simply put the .so file and the header file somewhere in my project and only use those. Never having learned C++ properly, I don't know how I can do this.

If I have an .so library and the header file for it, how do I put them in a folder of my chosing and include them in my source code?

You have several options:

  • You build with a static version of the library so you don't have such or problem.
  • You tell the user to install the library
  • You manually load the library, so you have your own search path for it (typically, current folder).

The last solution matches the most what you want, put may be quite difficult to set-up. There exist several library to easily load a .so file also.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM