4

For my thesis I want to use Dlib's face_landmark_detection, but I keep running into these errors (for both Visual studio 2013 as well as 2015):

"cannot open include file: 'zlib.h': No such file or directory" 

and

"'F77_INT': undeclared identifier". 

It repeats itself so I have 36 errors based on these two problems.

My supervisor has given me some steps to follow to set up the project:

  • add dlib-master and dlib-master\examples to VC++ directories -> include directories
  • add dlib-master\dlib\external\libjpeg and dlib-master\dlib\entropy_decoder to C/C++ -> General -> Additional include directories
  • add all folders and items from dlib-master\dlib\external (cblas, libjpeg, libpng and zlib) to the project source folder
  • add the dlib source file (from dlib-master\dlib\all) and add face_landmark_detection (from dlib-master\examples) to the project source folder.

and according to him this has worked on every other computer so far, but on my laptop it just won't. We checked to project, but zlib.h is in the zlib folder in the project. Does anyone here have an idea on what might be going wrong?

If I didn't give enough info, please ask. I don't know what else might be needed to solve this.

piyushj
  • 1,546
  • 5
  • 21
  • 29
Sharonneke95
  • 51
  • 2
  • 9
  • Which version of Visual Studio are you using.? –  Jun 16 '16 at 08:13
  • Both 2013 and 2015 wouldn't work. Now I am only working with 2013 – Sharonneke95 Jun 16 '16 at 12:42
  • Have you tried this [link](https://aleen42.gitbooks.io/personalwiki/content/qa/dlib.html). It describes clearly to configure dlib with Visual Studio 2013. –  Jun 16 '16 at 13:01
  • 1
    See , if if system cannot open `zlib.h` it means you have to provide the path to that file, so that it can add that file. –  Jun 16 '16 at 13:07
  • Hi @Sharonneke95, Can you let me know what solution worked for you. I'm trying on VS2017 – Susarla Nikhilesh Jan 04 '18 at 09:32
  • @susarla, we abandoned this and went about it another way. Did you try the two possible solutions mentioned in the answer section? Sorry I cannot be of more help – Sharonneke95 Jan 05 '18 at 11:46

2 Answers2

1

I have just come about this same problem and wanted to post my solution since I have found so much conflicting documentation on the subject.

The folder containing the dlib folder as well as the libpng, libjpeg, and zlib folders from dlib/external need to be added to the additional include directories list in the solution settings.

dlib/all/source.cpp as well as the source files for libpng, libjpeg, and zlib also need to be added to the project.

Note that CBLAS should not be added to the project in any way, because it needs Fortran to compile, and it is very difficult to get this to compile from Visual Studio.

Finally, make sure to add DLIB_PNG_SUPPORT and DLIB_JPEG_SUPPORT as preprocessor defines in the project settings.

I also attempted to use a cmake generated solution, however, for some reason it had trouble with png support.

Akh
  • 632
  • 1
  • 6
  • 15
0

It is probably easiest to use CMake to configure your project which uses dlib. It avoids setting all those paths manually. During CMake configure step you can disable usage of libraries like zlib which you don't have/want/need. Here is an example CMakeLists.txt which works for me:

cmake_minimum_required(VERSION 2.6)
PROJECT(DatasetClassifier CXX C)
set(dlib_DIR "" CACHE PATH "Path to dlib") # http://dlib.net/
include(${dlib_DIR}/dlib/cmake)
ADD_EXECUTABLE(DatasetClassifier DatasetClassifier.cpp)
TARGET_LINK_LIBRARIES(DatasetClassifier ${dlib_LIBRARIES})
Dženan
  • 3,329
  • 3
  • 31
  • 44
  • Sorry for the late answer. We decided to continue with different code, which is why I cannot really try this out anymore, but if I remember correctly, there was a CMake in the project. You think there might be a mistake in that one? – Sharonneke95 Jun 16 '16 at 12:45
  • 1
    Not necessarily a mistake in the CMakeLists.txt, but rather in the choice of enabled options when CMake is used to configure your projects. Try disabling zlib in CMake GUI. – Dženan Jun 20 '16 at 13:25