What .h and .lib files to include/link against ?
Posted: 2014-04-24T16:07:33-07:00
Not being able to find a post on the internet following many searches and some time, I'm going to ask this basic question here.
I'm wanting to use ImageMagick as static libraries (.lib) that I will link to from my own c/c++ program - by using the C API. Pretty straight forward.
I downloaded the source, built and ran the configure program, and then built the whole caboodle based on that config run.
Now, from what I can tell, the static library files are all in ImageMagick-6.8.9\VisualMagick\lib
And the .h files are all elsewhere, in ImageMagick-6.8.9\magick
Now the problem, I only want to add the .lib and .h files to my own project, if that .h and .lib are actually needed.
So first I tried just MagickCore.h... and quickly found that it wants a host of things in a magick subdirectory, so I created a magick subdirectory in my source tree and copied all the .h files there.
Ok, compile works, but now which .lib files do I need to link against? There are 27 .lib files of the form CORE_DB_xxx_.lib in the VisualMagick/lib directory.
I started with just linking against Core_DB_magick_.lib, but that isn't enough, trying to just do the basics in my source:
(my Visual Studio solution includes in the project 2 files directly in a VS filter: CORE_DB_magick_.lib, and MagickCore.h, the other .h files are in the project directory but not explicitly listedn in the VS project )
results in a host of linker errors about unresolved external symbols from CORE_D B_magick_.lib referencing a variety of .obj files (eg static.obj, blob.obj, annotate.obj, ...)
Should I be linking against more of the .lib files? If yes, which ones? I don't want to put 27 items in the linker line in VisualStudio 2010, there has to be some way of knowing which .h and .lib files I need in order to use which of the C API functions.
I'm guessing that the magic sauce from the sample program source shown for using the core API, `pkg-config --cflags --libs MagickCore`, might answer that question, however as there is no pkg-config on my install I cannot run that magic sauce to find the answer to my question.
What I intend to do in my C/C++ program is decode a BLOB (CCITT, PNG or JPEG) into an image, possibly resize/process the image, and convert the image into a JPEG or PNG blob.
I'm wanting to use ImageMagick as static libraries (.lib) that I will link to from my own c/c++ program - by using the C API. Pretty straight forward.
I downloaded the source, built and ran the configure program, and then built the whole caboodle based on that config run.
Now, from what I can tell, the static library files are all in ImageMagick-6.8.9\VisualMagick\lib
And the .h files are all elsewhere, in ImageMagick-6.8.9\magick
Now the problem, I only want to add the .lib and .h files to my own project, if that .h and .lib are actually needed.
So first I tried just MagickCore.h... and quickly found that it wants a host of things in a magick subdirectory, so I created a magick subdirectory in my source tree and copied all the .h files there.
Ok, compile works, but now which .lib files do I need to link against? There are 27 .lib files of the form CORE_DB_xxx_.lib in the VisualMagick/lib directory.
I started with just linking against Core_DB_magick_.lib, but that isn't enough, trying to just do the basics in my source:
(my Visual Studio solution includes in the project 2 files directly in a VS filter: CORE_DB_magick_.lib, and MagickCore.h, the other .h files are in the project directory but not explicitly listedn in the VS project )
Code: Select all
// For the ImageMagick Library
#include "MagickCore.h"
...
Image* imgMagickImage; // an imagemagick image handle
ImageInfo* imgMagickInfo; // the imagemagick image info object
ExceptionInfo* imgMagickException; // where exception information is stored from calls
MagickCoreGenesis(".", MagickTrue); // initialize the imagemagick environment
Should I be linking against more of the .lib files? If yes, which ones? I don't want to put 27 items in the linker line in VisualStudio 2010, there has to be some way of knowing which .h and .lib files I need in order to use which of the C API functions.
I'm guessing that the magic sauce from the sample program source shown for using the core API, `pkg-config --cflags --libs MagickCore`, might answer that question, however as there is no pkg-config on my install I cannot run that magic sauce to find the answer to my question.
What I intend to do in my C/C++ program is decode a BLOB (CCITT, PNG or JPEG) into an image, possibly resize/process the image, and convert the image into a JPEG or PNG blob.