I'd like to use the image processing package of Dlib (C++ library) in Visual Studio 2013.
我想在Visual Studio 2013中使用Dlib (c++库)的图像处理包。
I created an empty project and added "dlib-18.16\dlib\all\source.cpp" to my Source Files in the Solution Explorer. Then, I added the path to dlib-18.16 to my Include Directories in VC++ Directories and I also added the path to dlib-18.16\dlib to my Additional Include Directories in C/C++ General of Visual Studio.
我创建了一个空项目并添加了“dlib-18.16\dlib all\source”。cpp"到我的解决方案资源管理器的源文件。然后,我在vc++目录中添加了dlib-18.16的路径,并在Visual Studio的C/ c++ General目录中添加了dlib-18.16\dlib的路径。
I can run the file matrix_ex.cpp which is one of the examples of Dlib, but I can't run the file face_detection_ex.cpp because of the error " Cannot open include file:'type_safe_union/type_safe_union_kernel.h' " which is actually caused by the line #include <dlib/image_processing/frontal_face_detector.h>
我可以运行这个文件矩阵。cpp是Dlib的一个例子,但是我不能运行face_detection_ex文件。cpp由于错误“无法打开include文件:'type_safe_union/type_safe_union_kernel”。h' "实际上是由行#所引起的,包括
How can I resolve this issue? Why the program finds some header files but it can't find the others while they are all located in the same folder?
我如何解决这个问题?为什么程序会找到一些头文件,但是当它们都位于同一个文件夹时却找不到其他的头文件?
1 个解决方案
#1
1
You need to add the dlib folder itself to the Include Directories in VC++ Directories, you instead added the folder above it.
您需要将dlib文件夹本身添加到vc++目录中包含的目录中,您可以添加上面的文件夹。
By extension that would mean your include directive needs to be #include <image_processing/frontal_face_detector.h>
.
通过扩展,您的include指令需要是#include:
Let me list a hypothetical example to explain better. You downloaded dlib-18.16.tar.bz2
and extracted it to c:\projects
. This creates a folder named c:\projects\dlib-18.16
. Within VC++ Directories you added c:\projects\dlib-18.16
to the Include Directories.
让我举一个假设的例子来更好地解释。你下载dlib-18.16.tar。bz2并提取到c:\项目。这将创建一个名为c:\projects\dlib-18.16的文件夹。在vc++目录中添加了c:\projects\dlib-18.16到Include目录。
However this isn't correct, you should remove that directory and instead add c:\projects\dlib-18.16\dlib
as that is the include directory for the project.
但是,这是不正确的,您应该删除该目录,然后添加c:\projects\dlib-18.16\dlib,因为这是项目的包含目录。
That will cause #include <type_safe_union/type_safe_union_kernel.h>
to load C:\projects\dlib-18.16\dlib\type_safe_union\type_safe_union_kernel.h
as well as similar internal links between files.
这会导致#include
#1
1
You need to add the dlib folder itself to the Include Directories in VC++ Directories, you instead added the folder above it.
您需要将dlib文件夹本身添加到vc++目录中包含的目录中,您可以添加上面的文件夹。
By extension that would mean your include directive needs to be #include <image_processing/frontal_face_detector.h>
.
通过扩展,您的include指令需要是#include:
Let me list a hypothetical example to explain better. You downloaded dlib-18.16.tar.bz2
and extracted it to c:\projects
. This creates a folder named c:\projects\dlib-18.16
. Within VC++ Directories you added c:\projects\dlib-18.16
to the Include Directories.
让我举一个假设的例子来更好地解释。你下载dlib-18.16.tar。bz2并提取到c:\项目。这将创建一个名为c:\projects\dlib-18.16的文件夹。在vc++目录中添加了c:\projects\dlib-18.16到Include目录。
However this isn't correct, you should remove that directory and instead add c:\projects\dlib-18.16\dlib
as that is the include directory for the project.
但是,这是不正确的,您应该删除该目录,然后添加c:\projects\dlib-18.16\dlib,因为这是项目的包含目录。
That will cause #include <type_safe_union/type_safe_union_kernel.h>
to load C:\projects\dlib-18.16\dlib\type_safe_union\type_safe_union_kernel.h
as well as similar internal links between files.
这会导致#include