问题
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