A short example of implicitly linking the LPSolve library using CMake in C++
This is a short note on getting lpsolve to work for the C++ api. It actually took me a while to get it working, so I thought this minimal example might perhaps help other people who are also having trouble. I got it working after reading the post at cprogramming which details how to compile code with a shared library: https://www.cprogramming.com/tutorial/shared-libraries-linux-gcc.html.
Check out the github repository for the code. Below I explain the three steps required to run the crop example after downloading the code.
Running the crop example:
- Make a directory called
build
to contain the output of cmake. - Go to
build
and runcmake ..
to generate the needed Makefiles. - Run
make
to get the executablecrop_example
which can be executed.