我尝试在Windows下用arm-linux-gnueabihf-g++交叉编译树莓。我成功地尝试了一个"Hello Word"示例,但当我尝试使用挂架库"libpylonbase.so"时,
编译似乎还可以,但链接器告诉我它找不到"libpylon base.so"。我已经用-L添加了库的绝对路径,但它不起作用。为什么我说它找不到图书馆?以下是命令和结果:
C:SysGCC>raspberrybinarm-linux-gnueabihf-g++.exe -IC:SysGCCraspberryarm-linux-gnueabihfsysrootoptpylon5include
-L"C:SysGCCraspberryarm-linux-gnueabihfsysrootoptpylon5lib" -llibpylonbase.so -ggdb C:DevCrossSoftGrab_CameraEvents.cpp -o C:DevCrossSoftGrab_CameraEvents
In file included from c:sysgccraspberryarm-linux-gnueabihfincludec++6/vector:63:0,
from C:SysGCCraspberryarm-linux-gnueabihfsysrootoptpylon5include/GenApi/Autovector.h:36,
from C:SysGCCraspberryarm-linux-gnueabihfsysrootoptpylon5include/GenApi/Types.h:37,
from C:SysGCCraspberryarm-linux-gnueabihfsysrootoptpylon5include/GenApi/IValue.h:35,
from C:SysGCCraspberryarm-linux-gnueabihfsysrootoptpylon5include/GenApi/IEnumEntry.h:36,
from C:SysGCCraspberryarm-linux-gnueabihfsysrootoptpylon5include/GenApi/IEnumeration.h:36,
from C:SysGCCraspberryarm-linux-gnueabihfsysrootoptpylon5include/GenApi/Pointer.h:36,
from C:SysGCCraspberryarm-linux-gnueabihfsysrootoptpylon5include/GenApi/GenApi.h:38,
from C:SysGCCraspberryarm-linux-gnueabihfsysrootoptpylon5include/pylon/PylonIncludes.h:61,
from C:DevCrossSoftGrab_CameraEvents.cpp:38:
c:sysgccraspberryarm-linux-gnueabihfincludec++6/bits/stl_uninitialized.h: In function '_ForwardIterator std::__uninitialized_move_if_noexcept_a(_InputIterator,
_InputIterator, _ForwardIterator, _Allocator&) [with _InputIterator = long long int*; _ForwardIterator = long long int*; _Allocator = std::allocator<long long int>]':
c:sysgccraspberryarm-linux-gnueabihfincludec++6/bits/stl_uninitialized.h:304:69: note: parameter passing for argument of type 'std::move_iterator<long long int*>'
will change in GCC 7.1
_GLIBCXX_MAKE_MOVE_IF_NOEXCEPT_ITERATOR(__last), __result, __alloc);
.....
c:/sysgcc/raspberry/bin/../lib/gcc/arm-linux-gnueabihf/6/../../../../arm-linux-gnueabihf/bin/ld.exe: cannot find -llibpylonbase.so
collect2.exe: error: ld returned 1 exit status
所以我试着让Dir知道这条路,图书馆就在这里。那我为什么找不到呢?
C:SysGCC>dir C:SysGCCraspberryarm-linux-gnueabihfsysrootoptpylon5liblibpylonbase.*
Le volume dans le lecteur C s'appelle WIN7
Le numéro de série du volume est 0A4E-F0C9
Répertoire de C:SysGCCraspberryarm-linux-gnueabihfsysrootoptpylon5lib
07/11/2018 08:30 1 604 756 libpylonbase.so
1 fichier(s) 1 604 756 octets
0 Rép(s) 5 874 581 504 octets libres
事实上,为了正确链接此库,我删除了"lib"前缀:要链接">libpylonbase.so",指令为">-lpylonbase。我希望它对很多人有用。。。