来到VLC-QT的github官方地址--VLC-QT(点击前面的)

下载官方源码,也可以git clone拉取

2:解压源码之后,进入文件夹

创建文件夹“build”用于存放待会编译产生的相关文件,执行

mkdir build
cd build

 回到VLC-QT官方的github地址,往下拉,找到“Building and requirement”,点击进入,如图:

然后再新界面继续找到自己的系统,如图:我的是linux

 因为我们前面已经创建build文件夹并进入,所以我们直接执行:(这些操作都是在build目录中完成)

cmake .. -DCMAKE_BUILD_TYPE=Debug
make -j8
make install

完成后,build目录下,会多出许多文件:

其中:build目录下的src文件中的这三个里面的.SO文件(刚刚好每个都是三个.so文件,一共9个),移植到自己的Qt项目中,即可使用了

报错1:

        CMake Error at config/Dependencies.cmake:29 (FIND_PACKAGE): By not providing "FindQt5Quick.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "Qt5Quick", but CMake did not find one.

         Could not find a package configuration file provided by "Qt5Quick" (requested version 5.2.0) with any of the following names:

        Qt5QuickConfig.cmake

        qt5quick-config.cmake

        Add the installation prefix of "Qt5Quick" to CMAKE_PREFIX_PATH or set "Qt5Quick_DIR" to a directory containing one of the above files. If "Qt5Quick" provides a separate development package or SDK, be sure it has been installed.

   Call Stack (most recent call first):

        CMakeLists.txt:50 (INCLUDE)

则执行即可: (报错原因为:编译过程中,无法找到相关的Qt5Quick 的开发包)(下面命令是安装Qt5Quick的相关包)(注意执行完,安装好之后,重新执行“cmake .. -DCMAKE_BUILD_TYPE=Debug”)

sudo apt-get install qtdeclarative5-dev

报错2: 

CMake Error at config/Dependencies.cmake:28 (FIND_PACKAGE):
  By not providing "FindQt5Core.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Qt5Core", but
  CMake did not find one.

  Could not find a package configuration file provided by "Qt5Core"
  (requested version 5.2.0) with any of the following names:

    Qt5CoreConfig.cmake
    qt5core-config.cmake

  Add the installation prefix of "Qt5Core" to CMAKE_PREFIX_PATH or set
  "Qt5Core_DIR" to a directory containing one of the above files.  If
  "Qt5Core" provides a separate development package or SDK, be sure it has
  been installed.
Call Stack (most recent call first):

  CMakeLists.txt:51 (INCLUDE)

-- Configuring incomplete, errors occurred

报错原因:编译过程无法找到相关的Qt5

1:确保已经安装了 Qt5。如果没有就安装:

 sudo apt-get install qt5-default qtbase5-dev

   2:如果确保正确安装了Qt5,则设置 CMake 的路径:
        找到 Qt5 的安装路径,并将其添加到 CMAKE_PREFIX_PATH 或设置 Qt5Core_DIR。
        示例

cmake -DCMAKE_PREFIX_PATH=/qt5 ..(Qt5的安装路径)

或者:

cmake -DQt5Core_DIR=/path/to/qt5/lib/cmake/Qt5Core ..


确保 CMakeLists.txt 文件中包含了正确的 Qt5 查找指令:

find_package(Qt5Core 5.2 REQUIRED)

其他报错我还没遇到,如有其他情况,欢迎截图放在评论区下方,我如果看到会第一时间回复。

Logo

欢迎加入西安开发者社区!我们致力于为西安地区的开发者提供学习、合作和成长的机会。参与我们的活动,与专家分享最新技术趋势,解决挑战,探索创新。加入我们,共同打造技术社区!

更多推荐