我正在尝试导入这些头文件:
AffdexException.h Detector.h FaceListener.h Frame.h
PhotoDetector.h typedefs.h
CameraDetector.h Face.h FrameDetector.h ImageListener.h
ProcessStatusListener.h VideoDetector.h它们位于/root/affdex-sdk/include下。下面是我的基本工作区文件的样子:
new_local_repository(
name = "Boost",
path = "/usr/local/lib/",
build_file = "/usr/local/lib/BUILD.boost",
)
new_local_repository(
name = "OpenCV",
path = "/usr/lib/x86_64-linux-gnu/",
build_file = "/usr/lib/x86_64-linux-gnu/BUILD.opencv",
)
new_local_repository(
name = "AffdexSDK",
path = "/root/affdex-sdk/",
build_file = "/root/affdex-sdk/BUILD.affectiva",
)问题出在AffdexSDK头文件上。这是我的BUILD.affectiva:
package(default_visibility = ["//visibility:public"])
cc_library(
name = "affdex-sdk",
srcs = glob(["**/*.so"]),
hdrs = glob(["**/*.h"]),
)和带有我的主目标的构建文件,我希望将其转换为二进制文件:
cc_binary(
name = "video-detector",
srcs = ["vidDetector.cpp", "include/VideoDetector.h"],
deps = ["@AffdexSDK//:affdex-sdk",
"@Boost//:boost",
"@OpenCV//:opencv",
],
includes = [":affdex-sdk/include/"],
)以及我需要编译的主要源代码文件的声明:
#include <iostream>
#include <memory>
#include <chrono>
#include <fstream>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <boost/filesystem.hpp>
#include <boost/timer/timer.hpp>
#include <boost/program_options.hpp>
#include </root/affdex-sdk/include/VideoDetector.h>
#include </root/affdex-sdk/include/PhotoDetector.h>
#include </root/affdex-sdk/include/AffdexException.h>
#include "/root/sdk-samples/common/PlottingImageListener.hpp"
#include "/root/sdk-samples/common/StatusListener.hpp"当我运行bazel build //affdex-sdk:video-detector --verbose_failures命令时:
我得到了这个错误:
ERROR: /root/affdex-sdk/BUILD:1:1: undeclared inclusion(s) in rule '//affdex-sdk:video-detector':
this rule is missing dependency declarations for the following files included by 'affdex-sdk/vidDetector.cpp':
'/root/affdex-sdk/include/VideoDetector.h'
'/root/affdex-sdk/include/FrameDetector.h'
'/root/affdex-sdk/include/Detector.h'
'/root/affdex-sdk/include/typedefs.h'
'/root/affdex-sdk/include/ImageListener.h'
'/root/affdex-sdk/include/Face.h'
'/root/affdex-sdk/include/Frame.h'
'/root/affdex-sdk/include/FaceListener.h'
'/root/affdex-sdk/include/ProcessStatusListener.h'
'/root/affdex-sdk/include/AffdexException.h'
'/root/affdex-sdk/include/PhotoDetector.h'
'/root/sdk-samples/common/PlottingImageListener.hpp'
'/root/sdk-samples/common/StatusListener.hpp'所以我不确定为什么没有包含这些文件,因为我是通过BUILD.affectiva中的glob获得这些头文件的。我在vidDetector.cpp的声明中使用了绝对路径,因为它不会以其他方式获取它们。我不确定如何包含sdk-samples/common hpp文件,但我假设affdex-sdk中的其他头文件都是通过BUILD.affectiva中的glob包含的。请帮帮我。
发布于 2017-09-12 22:43:03
通常,调试此类问题的好方法是查看复制到沙箱中的内容。有一个关于这个主题的blog post。
现在针对您的特定问题,我认为您应该将includes属性放到@AffdexSDK//:affdex-sdk规则中,并从:video-detector中删除它。然后,您应该能够引用与其包含目录相关的头文件,例如#include <Detector.h>。
您还可以使用strip_include_prefix和include_prefix属性将包含路径调整为您喜欢的路径。
https://stackoverflow.com/questions/46127525
复制相似问题