How to compile a dlib example using eclipse in windows?

与世无争的帅哥 提交于 2019-12-11 07:28:29

问题


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 :

  • 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: 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 ?


回答1:


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

Requirements :

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

Steps :

  • 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 !!

Note :

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.



来源:https://stackoverflow.com/questions/35937454/how-to-compile-a-dlib-example-using-eclipse-in-windows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!