c - Use ImageWand component of ImageMagick lib with CMake -


i'm programming in c. want use imagemagick library fuction can't resolved.

this cmakelist.txt file:

cmake_minimum_required(version 3.3) project(webserver)  set(cmake_c_compiler "/usr/bin/gcc")  set(source_files io.c server.c lock_fcntl.c sig_handler.c thread_job.c    msg_parser.c) set(lib http-parser-master/http_parser.c )  set(cmake_use_pthreads_init true) set(cmake_use_pthreads_init on)  find_package(threads required) find_package(imagemagick components imagewand)  include_directories(header) include_directories(http-parser-master)  #include_directories(/usr/local/include/imagemagick-7/magickwand) include_directories(${imagemagick_include_dirs})  add_executable(server ${source_files} ${lib}) add_executable(client client.c io.c) add_executable(main main.c io.c)  target_link_libraries(main ${imagemagick_libraries}) target_link_libraries(server threads::threads) 

and source main.c:

#include <imagemagick-7/magickwand/magickwand.h> #include "basic.h"  void convert_image(char *path, float quality_factor, char *out) {      int width, height;     magickwand *n_wand = null;      magickwandgenesis();      m_wand = (struct magickwand *) newmagickwand();       magickreadimage(m_wand,"logo:");      width = magickgetimagewidth(m_wand);     height = magickgetimageheight(m_wand);      if((width /= 2) < 1)width = 1;     if((height /= 2) < 1)height = 1;      magickresizeimage(m_wand,width,height,lanczosfilter,1);      magicksetimagecompressionquality(m_wand,95);      magickwriteimage(m_wand,"logo_resize.jpg");     if(m_wand)m_wand = (struct magickwand *) destroymagickwand(m_wand);      magickwandterminus(); } 

only magickwandgenesis() , magickwandterminus() resolved. installation of library ends correctly. how solve?

edit:

running error:

/usr/local/include/imagemagick-7/magickwand/magickwand.h:29:40: fatal     error: magickcore/magick-config.h: file o directory non esistente  #  include "magickcore/magick-config.h"                                     ^ compilation terminated. make[3]: *** [cmakefiles/main.dir/main.c.o] errore 1 make[2]: *** [cmakefiles/main.dir/all] errore 2 make[1]: *** [cmakefiles/main.dir/rule] errore 2 make: *** [main] errore 2 

i tried solution shown here not work: imagemagick no such file or directory

the library structure that:

imagemagick-7     ├── magickcore     │   ├── magick-config.h     |     └── magickwand         ├── magickwand.h 

magickwand.h includes header in magickcore. fix replacing include_directories(${imagemagick_include_dirs}) include_directories(/usr/local/include/imagemagick-7). don't know why if print ${imagemagick_include_dirs} not set.


Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

mapreduce - Resource manager does not transit to active state from standby -

serialization - Convert Any type in scala to Array[Byte] and back -