I have compiled this library successfully. It generates a libcds2.la
file that I am trying to link into my own project. I have all files (including the .h
file) in the same directory as my project file. When I try to link and use the functions of said library, using:
g++ -o test -I/opt/include/ -L/opt/lib/ -lcds2 libcdsNoptrs.cpp util.cpp
comes back with
./test: error while loading shared libraries: libcds2.so.2:
cannot open shared object file: No such file or directory
whatever that is. But the point is that most of the time it just doesn't recognize the library. I assume I'm doing something wrong with the file paths, but can't figure it out. My test file is a C++ file including #include "libcds2/array.h"
and everything is installed in opt/lib
, opt/include
, ugly, I know, but that's what the Makefile generated.
Any pointers?
The libtool
.la
is a 'meta data' file. After building thecds2
library, it's expected that libtool will also be used in 'link' mode to build any of the package's tests, etc.Typically, the in the directory you find the
.la
file, you will find the.a
and.so
under the.libs
subdirectory. The.libs/libcds2.a
file will be found there, providedconfigure
was given the--enable-static
option (or it is enabled by default). But, my understanding is that you've installed the package in/opt
:Otherwise, if
libcds2
isn't installed, just supply a path to:.../libcds2/lib/.libs/libcds2.a
Unless you want to use libtool in
--link
mode with-static
to handle everything. But learning the advantages of libtool is usually an exercise for a rainy day:)