Menu

Unable to load jpeg unless I include all the files under libjpeg

Help
2016-06-02
2016-06-03
  • Sagar B Hathwar

    Sagar B Hathwar - 2016-06-02

    Hey,

    Here are my OS, Compiler and other details
    OS - Windows 10 64 bit
    Compiler - Visual Studio 2015 Win64
    Static or Shared library - Shared

    First I compiled Opencv, then dlib. After compiling opencv, I obtained libjpeg.lio in my 3dparty folder. OpenCV works fine with it but dlib just doesnt. I also defined DLIB_JPEG_SUPPORT globally, but the compiler complains that it cannot find libjpeg.h!
    I defined DLIB_JPEG_SHARED, this time, I get
    "Exception thrown!
    You must #define DLIB_JPEG_SUPPORT and link to libjpeg to read JPEG files.
    Do this by following the instructions at http://dlib.net/compile.html."

    Then I included all the files under external\libjpeg and only then it works.

    Problem is everything compiles again and again making compilation so slow
    Is there a better way of creating a libjpeg.lib or dll so that I need not compile it again and again?

    Thanks

     
    • Davis

      Davis - 2016-06-02

      Visual studio will only recompile files if they change or you deliberately
      tell it to clean the project and rebuild everything. So if you let it do
      normal incremental builds you won't have build time problems.

       
      • Sagar B Hathwar

        Sagar B Hathwar - 2016-06-03

        Guess that's fine

        One question though, why doesn't the jpeglib.lib compiled with opencv work with dlib?

         
        • Davis

          Davis - 2016-06-03

          It works fine if you put the header files for that version of libjpeg in your compiler's include search path.

           
  • raffic maleo

    raffic maleo - 2017-07-14

    Hello,
    I am new to C++ and using MINGW 64 on windows 8 to compile this

    g++ -static -static-libgcc -static-libstdc++ -std=c++11 -O3 -I.. ../dlib/all/source.cpp -I.. -luser32 -lws2_32 -lgdi32 -lcomctl32 -limm32 -lpthread -lkernel32 -ladvapi32 -lshell32 -lmsvcrt -lwinmm -ldxguid -lz -DDLIB_JPEG_SUPPORT -DDLIB_PNG_SUPPORT my_ex.cpp

    i am getting this error
    ../dlib/all/../image_loader/png_loader.cpp:13:17: fatal error: png.h: No such fi
    le or directory #include <png.h></png.h>

    How do i use the source directory of the libpng and libjpeg in the dlib/external/ folder in the gcc command line.

     
    • Davis

      Davis - 2017-07-14

      If you are new to C++ then use cmake. http://dlib.net/compile.html tells
      you what to type.

       

Log in to post a comment.