我试图将我的Qt程序作为可执行文件分发。唯一将使用它的人已经在他们的计算机上安装了正确的Qt版本(5.7.1)。我目前正在我自己的计算机上测试它,并尝试运行可执行文件失败。我在它上面运行ldd并得到以下输出:
ldd MyProg
./MyProg: /usr/lib/x86_64-linux-gnu/libQt5PrintSupport.so.5: version `Qt_5' not found (required by ./MyProg)
./MyProg: /usr/lib/x86_64-linux-gnu/libQt5Quick.so.5: version `Qt_5_PRIVATE_API' not found (required by ./MyProg)
./MyProg: /usr/lib/x86_64-linux-gnu/libQt5Quick.so.5: version `Qt_5' not found (required by ./MyProg)
./MyProg: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5.7' not found (required by ./MyProg)
./MyProg: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5' not found (required by ./MyProg)
./MyProg: /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5: version `Qt_5' not found (required by ./MyProg)
./MyProg: /usr/lib/x86_64-linux-gnu/libQt5Qml.so.5: version `Qt_5' not found (required by ./MyProg)
./MyProg: /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5: version `Qt_5' not found (required by ./MyProg)
linux-vdso.so.1 => (0x00007ffe404d4000)
liblapack.so.3 => /usr/lib/liblapack.so.3 (0x00007faa6df37000)
libblas.so.3 => /usr/lib/libblas.so.3 (0x00007faa6dcc8000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007faa6daad000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007faa6d890000)
libpng16.so.16 => /lib/x86_64-linux-gnu/libpng16.so.16 (0x00007faa6d65f000)
libSDL2-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0
等...
我不确定为什么这些图书馆缺少" Qt_5"变量即使它们是5.7.1版本的库。正如您所看到的,这不是一个路径问题,因为它成功地在该目录中找到了其他库。