如何在Windows中使用Eclipse编译dlib示例? [英] How to compile a dlib example using eclipse in windows?

查看:134
本文介绍了如何在Windows中使用Eclipse编译dlib示例?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我下载了dlib,我想在Windows中使用eclipse-cdt编译示例目录中的文件之一。这是我现在所做的:

I downloaded dlib and I want to compile one of the files in the examples directory using eclipse-cdt in windows. Here is what I did for now :


  • 将dlib下载到C:\dlib-18.18

  • 在eclipse中创建新项目

  • 在此项目中创建src文件夹

  • 从src内的examples目录中放置文件(例如face_dection_ex.cpp )

  • 将dlib / all / source.ccp放入src中

  • 将C:\dlib-18.18\dlib添加到我的包含路径中(GCC C ++编译器)

  • 将DLIB_JPEG_SUPPORT添加到我的预处理器(GCC C ++编译器)

  • 在MinGW Linker中添加以下库:comctl32,user32,winmm,imm32 ,gdi32,ws2_32

  • Download dlib to C:\dlib-18.18
  • Create a new project in eclipse
  • Create a folder src in this project
  • Put a file from examples directory inside src (for example face_dection_ex.cpp)
  • Put dlib/all/source.ccp inside src
  • Add C:\dlib-18.18\dlib to my include paths (GCC C++ Compiler)
  • Add DLIB_JPEG_SUPPORT to my preprocessor (GCC C++ compiler)
  • Add the following libraries in MinGW Linker : comctl32, user32, winmm, imm32,gdi32, ws2_32

当我尝试构建项目时,出现以下错误:

When I try to build my project, I get the following error :

.. \src\source.cpp:7:41:致命错误:../base64/base64_kernel_1.cpp:没有这样的文件或目录
#include ../base64/ base64_kernel_1.cpp
^
编译已终止

..\src\source.cpp:7:41: fatal error: ../base64/base64_kernel_1.cpp: No such file or directory #include "../base64/base64_kernel_1.cpp" ^ compilation terminated

您能告诉我我缺少什么吗?

Can you pkease tell me what I am missing ?

解决方案

由于戴维斯的建议,我终于找到了实现该目标的方法。

I finally found out how to achieve this thanks to Davis' suggestions.

要求:

  • Install cmake : https://cmake.org/
  • Install MinGW : http://www.mingw.org/

步骤:


  • cd示例

  • cmake -G Eclipse CDT4-MinGW Makefiles -D CMAKE_C_COMPILER = gcc- D CMAKE_CXX_COMPILER = g ++。

  • 最后一条命令将为eclipse项目生成所需文件

  • 现在打开eclipse并新建-> import-> general ->将现有项目导入到工作区中,然后选择examples目录。这会将cmake生成的项目导入到您的工作区中。

  • 使用dlib享受开发的乐趣!

  • cd examples
  • cmake -G "Eclipse CDT4 - MinGW Makefiles" -D CMAKE_C_COMPILER=gcc -D CMAKE_CXX_COMPILER=g++ .
  • This last command will generate the required files for an eclipse project
  • Now Open eclipse and new->import->general->import existing projects into workspace , then choose examples directory. This will import the project generated by cmake to your workspace.
  • Enjoy your developements with dlib !!

注意:

如果您创建一个使用dlib的新项目,这些步骤也可以使用。您所要做的就是将CMakeLists文件复制到您的目录中,并使其适应您的项目。

These steps can also work if you create a new project that uses dlib. All you have to do is copy the CMakeLists file to your directory and adapt it to your project.

这篇关于如何在Windows中使用Eclipse编译dlib示例?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆