Page 1 of 1

Using ImageMagick in Dev C++

Posted: 2010-07-18T02:38:08-07:00
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.

Re: Using ImageMagick in Dev C++

Posted: 2010-07-18T08:26:40-07:00
by el_supremo
Can you show us the first 20 or so error messages? There might be a clue there.

Pete

Re: Using ImageMagick in Dev C++

Posted: 2010-07-18T21:48:09-07:00
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.

Re: Using ImageMagick in Dev C++

Posted: 2010-07-19T09:30:21-07:00
by el_supremo
I've never used DEV C++ so I can't help you with it. Sorry.

Pete

Re: Using ImageMagick in Dev C++

Posted: 2010-07-19T23:02:29-07:00
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?

Re: Using ImageMagick in Dev C++

Posted: 2010-07-22T17:52:04-07:00
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

Re: Using ImageMagick in Dev C++

Posted: 2011-01-13T04:22:49-07:00
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

Re: Using ImageMagick in Dev C++

Posted: 2011-01-13T06:03:24-07:00
by magick
MagickReadImage() is a method found in the MagickWand library. Verify you have included the MagickWand library in your link command line.

Re: Using ImageMagick in Dev C++

Posted: 2011-01-13T06:37:36-07:00
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

Re: Using ImageMagick in Dev C++

Posted: 2011-01-13T07:21:22-07:00
by Marcel
After reinstalling ImageMagick everything works fine :D
Thanks for your support