+86-18555129021
contact@oakchina.cn

【31】fatal error: no#include ,nop/serializer.h:没有那个文件或目录

【31】fatal error: no#include ,nop/serializer.h:没有那个文件或目录

报错提示:

找不到serializer.h文件

或是其他cmake找不到文件,

Could not find a package configuration file provided by “depthai” with any of the following names:

depthaiConfig.camke

depthaiConfig.camke

都可参考下面的方法

解决方法:

在发行版中,你可能会找到适用于 Windows 的预构建库,可用于任一集成方法。见发布

CMake可链接的目标是

  • depthai::core – 核心库,内部不使用 opencv
  • depthai::opencv – Core + 支持 opencv 相关的辅助函数(需要 OpenCV4 )

使用 find_package
find_package target_link_libraries 添加到你的项目中

find_package(depthai CONFIG REQUIRED)

target_link_libraries([my-app] PRIVATE depthai::opencv)

并将 CMake 指向目录:

-D'depthai_DIR=/depthai-core-v{version}-win64/lib/cmake/depthai'

或者

-D'depthai_DIR=/usr/local/lib/cmake/depthai'

如果库安装到 Linux 上的默认搜索路径(即使用 deb 安装),则无需指定 depthai_DIR,因为 CMake 会自动找到它。

非 CMake 集成(Visual Studio, Xcode, CodeBlocks, …)

在你的非CMake项目(新的Visual Studio项目,…)中

1.设置需要的库目录:

  • <path>/depthai-core-v{version}-win64/lib (用于链接到 depthai-coredepthai-opencv)
  • <path>/depthai-core-v{version}-win64/bin(用于 .dll 的)

2.And include directories

  • <path>/depthai-core-v{version}-win64/include (library headers)
  • <path>/depthai-core-v{version}-win64/include/depthai-shared/3rdparty (shared 3rdparty headers)
  • <path>/depthai-core-v{version}-win64/lib/cmake/depthai/dependencies/include (dependency headers)

ℹ️ 线程库可能需要显式链接。

小技巧:遇到报错先在这里搜索,无法找到解决方法时可在我们群内提问!