im trying to build a shared library on a windows cygwin platform using g++, and later link it with another cpp file: i use the following commands:
// generat
When using -l<libname>
to specify library to link, the linker will first search for lib<libname>.so
before searching for lib<libname>.a
.
In your case it doesn't work, because the library filename is not with .so
suffix.
You may create simlink
libbeat.so -> libbeat.so.1.0.1
or
libbeat.so -> libbeat.so.1
libbeat.so.1 -> libbeat.so.1.0.1
You can also use -l:libbeat.so.1.0.1
(if your linker supports it, check in man ld
description of -l
parameter). Another option is to specify the library without -l
g++ -o checkbeat checkbeat.cpp -I . -L. libbeat.so.1.0.1
Note that the library you link to should be put after object/source file using its symbols - otherwise the linker may not find the symbols.