How to use or add a shared library (.so) into a C++ project in CLion and use method contained on .so file

150 Views Asked by At

I have a c++ method on .so lib that receive a number and return "hello world". Then how can i import it on other c++ project on cMakeList and call on main.cpp. but i have a doubt how can i inform a compiler that .hpp methods declarated was implemented on .so lib. tried to include .so lib on cMakeList and created .h file that declared a function that receive a number and return a string. I having this issue undefined reference to

1

There are 1 best solutions below

0
David On

You can create a library with CMake, then you install it somewhere or make it available on an artifact repository / server, then you can use it with CMake by providing its location and using find_package in the consuming project.