Page 1 of 1

Problems linking ImageMagic.h, syntax error: ssize_t

Posted: 2012-01-07T19:46:10-07:00
by jxbp
Hi everyone,

I new to ImageMagick and was hoping to start working with it, but when I tried to link ImageMagick.h, a series of errors come up during building, all relating to ssize_t.
I am currently working with c++ in visual studio 2010, on windows 7. I am trying to work with the source code for ImageMagick-6.7.4-4. My code at the moment is just:

#include "magick\ImageMagick.h"

int main()
{
return 0;
}

The errors that come up during building are of the form:

error C201: syntax error indentifier 'ssize_t'
error C2086: 'const int size_t' : redefinition
IntelliSense: identifier "ssize_t" is undefined

and these repeat for various files such as delegate.h, deprecate.h, etc...

Does anyone have an idea what might be causing these errors, and possible fixes?

Thanks,

Re: Problems linking ImageMagic.h, syntax error: ssize_t

Posted: 2012-01-07T20:49:39-07:00
by el_supremo
Try each of these.

For C programs which use MagickWand I use this:
#include <wand/magick_wand.h>

A C program using MagickCore would use:
#include <magick/MagickCore.h>

The button demo for Magick++ uses:
#include <Magick++.h>

Pete

Re: Problems linking ImageMagic.h, syntax error: ssize_t

Posted: 2012-01-07T21:31:27-07:00
by jxbp
Thanks for your response, I tried your suggestions. I am trying to write a c++ program, so for the includes I used something like:
extern "C" {
#include <magick/MagickCore.h>
}
but the same errors still pop up. I have taken a look at one of the file where the errors are and the line that was marked was:

extern MagickExport MagickStatusType
GetGeometry(const char *,ssize_t *,ssize_t *,size_t *,size_t *),

I have never worked with C source before so I can't tell if there is something wrong. I am not sure if the source files that I have are bugged or I am missing something when linking them. I suspect the latter though.

Re: Problems linking ImageMagic.h, syntax error: ssize_t

Posted: 2012-01-08T06:52:18-07:00
by magick
We build ImageMagick with Visual Studio 2010 on Windows 7 without complaint. However, if ssize_t is undefined you can always use this define:
  • #if !defined(ssize_t)
    typedef long ssize_t;
    #endif

Re: Problems linking ImageMagic.h, syntax error: ssize_t

Posted: 2012-01-08T10:23:17-07:00
by jxbp
Thanks Magick, that resolved most of the errors. But a couple of errors still remain:

error C2485: '_restrict' : unrecognized extended attribute

and that error repeats for several lines in stdlib.h.

I was wondering, I got the source codes from ftp://ftp.fifi.org/pub/ImageMagick/windows/
and I downloaded ImageMagick-6.74-4.zip and extracted everything. Is that all I need to use ImageMagick or are there files that I should download along with it? Perhaps that is why I am getting so many complaints.

Edit: Thanks everyone for your help, ImageMagick is building just fine now. Thanks a lot.