[英]How do I include a library in an .so file in C++
我試圖編譯依賴於FTDI庫的.so
文件。 我不確定如何包括該庫,以便正確編譯。 (以下是我的最佳猜測)。 這是可能的還是有其他解決方法?
shared: pldevice pldeviceenttecpro pluniverse
$(CC) -shared -Wl,-soname,libplanklight.so -o libplanklight.so\
-L/usr/local/lib -lftd2xx \
pldevice.o pldeviceenttecpro.o pluniverse.o
編輯:這是什么輸出:
g++ -fPIC -c pldevice.cpp
g++ -fPIC -c pldeviceenttecpro.cpp
g++ -fPIC -c pluniverse.cpp
g++ -shared -Wl,-soname,libplanklight.so -o libplanklight.so\
-L/usr/local/lib -lftd2xx \
pldevice.o pldeviceenttecpro.o pluniverse.o
/usr/bin/x86_64-linux-gnu-ld: cannot open output file libplanklight.so-L/usr/local/lib: No such file or directory
collect2: error: ld returned 1 exit status
Makefile:5: recipe for target 'shared' failed
make: *** [shared] Error 1
您缺少空格。
$(CC) -shared -Wl,-soname,libplanklight.so -o libplanklight.so \
^^
Add a space here
\\只是使命令在下一行繼續,所以當
-o libplanklight.so\
-L/usr/local/lib
它將與-o libplanklight.so-L/usr/local/lib
但是你想要-o libplanklight.so -L/usr/local/lib
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.