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:
// generate object file
g++ -g -c -Wall -fPIC beat11.cpp -o beat11.o
// to generate library from the object file
g++ -shared -Wl,-soname,libbeat.so.1 -o libbeat.so.1.0.1 beat11.o -lc
// to link it with another cpp file; -I option to refer to the library header file
g++ -L. -lbeat -I . -o checkbeat checkbeat.cpp
while linking, the following error crops up:
/usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../i686-pc-cygwin/bin/ld:
cannot find -llibbeat.so.1.0.1
collect2: ld returned 1 exit status
the library gets created just fine, but i can only find libbeat.so.1.0.1, not libbeat.so or libbeat.so.1(or are they not supposed to be there?)
one of the other questions suggests creating a symlink to libbeat.so.1.0.1, but that too didnt work
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…