Problems linking ImageMagic.h, syntax error: ssize_t

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
jxbp
Posts: 5
Joined: 2012-01-07T19:03:42-07:00
Authentication code: 8675308

Problems linking ImageMagic.h, syntax error: ssize_t

Post 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,
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

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

Post 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
Sorry, my ISP shutdown all personal webspace so my MagickWand Examples in C is offline.
See my message in this topic for a link to a zip of all the files.
jxbp
Posts: 5
Joined: 2012-01-07T19:03:42-07:00
Authentication code: 8675308

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

Post 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.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

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

Post 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
jxbp
Posts: 5
Joined: 2012-01-07T19:03:42-07:00
Authentication code: 8675308

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

Post 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.
Post Reply