Using ImageMagick in Dev C++

The MagickWand interface is a new high-level C API interface to ImageMagick core methods. We discourage the use of the core methods and encourage the use of this API instead. Post MagickWand questions, bug reports, and suggestions to this forum.
Post Reply
Evil_Jim132

Using ImageMagick in Dev C++

Post by Evil_Jim132 »

Hi all,

I am using the Bloodshed Dev C++ program to write a C program, and I am having problems getting my program to compile because the compiler says that there are a HUGE amount of syntax errors contained within the ImageMagick header files. Relevant code included below

Code: Select all

#include <stdio.h>
#include <string.h>
#include <wand/MagickWand.h>
The amount of errors is crazy, far too many to try to correct manually.

Is there something I've done wrong or should I abandon my line of thought.

My program is trying to take user input then turn the text string into a DIB image but I can't compile past the #includes.

I have not changed any compiler options.
Please help.
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: Using ImageMagick in Dev C++

Post by el_supremo »

Can you show us the first 20 or so error messages? There might be a clue there.

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.
Evil_Jim132

Re: Using ImageMagick in Dev C++

Post by Evil_Jim132 »

Ok, now the syntax of the header files are all right.
I am trying to run an example program manipulating text effects, but I have run into some more problems
The program I am trying to run is here http://members.shaw.ca/el.supremo/Magic ... ffects.htm

The compiler is saying that every function I call to do with MagicWand is undefined.

Code: Select all

  [Linker error] undefined reference to `NewMagickWand' 
  [Linker error] undefined reference to `MagickReadImage' 
  [Linker error] undefined reference to `MagickGetImageWidth' 
  [Linker error] undefined reference to `MagickGetImageHeight' 
etc

I have read all the stuff on the forums and found it to be most unhelpful.

I am also not sure where to put the

Code: Select all

$magick> cc `MagickWand-config --cflags --cppflags` -o wand wand.c \
`MagickWand-config --ldflags --libs`
into Dev C++ and how to put it in.

Every time I try to either add it to the linker command line or 'add the following commands when calling compiler' section I get errors say that --cflags --cppflags --ldflags & --libs are unrecognised commands.
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: Using ImageMagick in Dev C++

Post by el_supremo »

I've never used DEV C++ so I can't help you with it. Sorry.

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.
Evil_Jim132

Re: Using ImageMagick in Dev C++

Post by Evil_Jim132 »

I don't think its a problem with Dev C++. It looks like the compiler isn't finding any references for any of the Magick Wand Functions. ie NewMagickWand, MagickReadImage etc

Has anyone else had the same problem?
xt5

Re: Using ImageMagick in Dev C++

Post by xt5 »

you have to reference the MagickWand library.
luckly for us it come in the ImageMagick windows binaries package among the headers.

make sure you follow this 2 steps and you will be OK with Dev-Cpp:

1.- in the proyect options/parameters: add the CORE_RL_wand_.lib file to the additional command line of the linker.
you have to use the full path (or add a default library search path)
Image

2.- in the proyect options/directory: add the path where the ImageMagick headers are:
Image

hope this can fix the problem
Marcel
Posts: 4
Joined: 2011-01-13T04:02:47-07:00
Authentication code: 8675308

Re: Using ImageMagick in Dev C++

Post by Marcel »

Hi all, hi xt5,

I also want to use Dev C++ and followed your 2 steps. Compiling my code then works fine, but I still get many linking errors e.g. [Linker error] undefined reference to `MagickReadImage' . See this two pictures of my configuration:
http://www.imgbox.de/show/img/ZRoJDSKbbH.png/
http://www.imgbox.de/show/img/sOOKMbEDen.png/
My Code is the code of the example "wand.c" from http://www.imagemagick.org/script/magick-wand.php.
Can anybody please help me?

Thanks and Cheers
Marcel
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Using ImageMagick in Dev C++

Post by magick »

MagickReadImage() is a method found in the MagickWand library. Verify you have included the MagickWand library in your link command line.
Marcel
Posts: 4
Joined: 2011-01-13T04:02:47-07:00
Authentication code: 8675308

Re: Using ImageMagick in Dev C++

Post by Marcel »

I have included MagickWand library by adding it to the linker parameters in project options.

Image

I clicked on "Add Library or Object" and selected "CORE_RL_magick_.lib" and "CORE_RL_wand_.lib" from the lib directory of ImageMagick.
Here's the generated makefile

Code: Select all

# Makefile created by Dev-C++ 4.9.9.2

CPP  = g++.exe
CC   = gcc.exe
WINDRES = windres.exe
RES  = 
OBJ  = test.o $(RES)
LINKOBJ  = test.o $(RES)
LIBS =  -L"C:/Dev-Cpp/lib" ../lib/CORE_RL_magick_.lib ../lib/CORE_RL_wand_.lib  
INCS =  -I"C:/Dev-Cpp/include"  -I"C:/Programme/ImageMagick-6.6.7-Q16/include" 
CXXINCS =  -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include"  -I"C:/Dev-Cpp/include/c++/3.4.2/backward"  -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32"  -I"C:/Dev-Cpp/include/c++/3.4.2"  -I"C:/Dev-Cpp/include"  -I"C:/Programme/ImageMagick-6.6.7-Q16/include" 
BIN  = Test.exe
CXXFLAGS = $(CXXINCS) -DBUILDING_DLL=1  
CFLAGS = $(INCS) -DBUILDING_DLL=1  
RM = rm -f

.PHONY: all all-before all-after clean clean-custom

all: all-before Test.exe all-after


clean: clean-custom
	${RM} $(OBJ) $(BIN)

$(BIN): $(OBJ)
	$(CC) $(LINKOBJ) -o "Test.exe" $(LIBS)

test.o: test.c
	$(CC) -c test.c -o test.o $(CFLAGS)
What I am doing wrong? How to integrate the MagickWand library correctly?

Thanks
Marcel
Posts: 4
Joined: 2011-01-13T04:02:47-07:00
Authentication code: 8675308

Re: Using ImageMagick in Dev C++

Post by Marcel »

After reinstalling ImageMagick everything works fine :D
Thanks for your support
Post Reply