Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » GraphicsMagick on Eclipse(Configuring Setting for the Magick++ (c++ API from graphicsMagick))
GraphicsMagick on Eclipse [message #505158] Mon, 28 December 2009 08:49 Go to next message
aykay78  is currently offline aykay78 Friend
Messages: 2
Registered: December 2009
Junior Member
Hi,
I'm, having problems with configuring GraphicsMagick libraries on Eclipse.

http://www.graphicsmagick.org
http://www.graphicsmagick.org/INSTALL-unix.html
http://www.graphicsmagick.org/Magick++/index.html


It's working when I compile and link programs from the command line (under MinGW) on Windows Vista:

g++ -o GraphicsProj1 GraphicsProj1.cpp `GraphicsMagick++-config --cxxflags --cppflags --ldflags --libs` 


This is what's behind `GraphicsMagick++-config --cxxflags --cppflags --ldflags --libs`:
$ GraphicsMagick++-config --cppflags --cxxflags --ldflags --libs
-I/usr/local/include/GraphicsMagick -D_DLL -D_MT
-g -O2
-L/usr/local/lib -L/mingw/GnuWin32/lib -L/mingw/GnuWin32/bin
-lGraphicsMagick++ -lGraphicsMagick -ljbig -ltiff -lfreetype -ljpeg -lpng -lwmflite -lbz2 -lz -lgdi32 -l


This generates .exe file and which works fine.

However, I'm having problems to make it work on Eclipse:

This is the simple exemplary code ( from documentation) that I'm trying to run (that is compiled and linked without problem from the command line):

#include <Magick++.h>
using namespace std;
using namespace Magick;
int main(int argc,char **argv)
{
    Image image( "100x100", "white" );
    image.pixelColor( 49, 49, "red" );
    image.write( "red_pixel.png" );
    return 0;
}


I'm getting following "undefined reference" errors:

g++ -LC:\msys\1.0\local\lib -LC:\MinGW\GnuWin32\lib -LC:\MinGW\GnuWin32\bin -LC:\MinGW\GraphicsMagick-1.3.7\magick\.libs -LC:\MinGW\GraphicsMagick-1.3.7\Magick++\lib\.libs -LC:\MinGW\GraphicsMagick-1.3.7\wand\.libs -shared -Wl,--out-implib=-lGraphicsMagick++ -lGraphicsMagick -ljbig -ltiff -lfreetype -ljpeg -lpng -lwmflite -lbz2 -lz -lgdi32 -lm -olibGraphicsProject.exe GraphicsProject.o
Creating library file: -lGraphicsMagick++
GraphicsProject.o: In function `main':
C:/Users/dru/workspace/GraphicsProject/Debug/../GraphicsProject.cpp:6: undefined reference to `Magick::Color::Color(char const*)'
C:/Users/dru/workspace/GraphicsProject/Debug/../GraphicsProject.cpp:6: undefined reference to `Magick::Geometry::Geometry(char const*)'
C:/Users/dru/workspace/GraphicsProject/Debug/../GraphicsProject.cpp:6: undefined reference to `Magick::Image::Image(Magick::Geometry const&, Magick::Color const&)'
C:/Users/dru/workspace/GraphicsProject/Debug/../GraphicsProject.cpp:6: undefined reference to `Magick::Geometry::~Geometry()'
C:/Users/dru/workspace/GraphicsProject/Debug/../GraphicsProject.cpp:6: undefined reference to `Magick::Geometry::~Geometry()'
C:/Users/dru/workspace/GraphicsProject/Debug/../GraphicsProject.cpp:6: undefined reference to `Magick::Color::~Color()'
C:/Users/dru/workspace/GraphicsProject/Debug/../GraphicsProject.cpp:6: undefined reference to `Magick::Color::~Color()'
C:/Users/dru/workspace/GraphicsProject/Debug/../GraphicsProject.cpp:7: undefined reference to `Magick::Color::Color(char const*)'
C:/Users/dru/workspace/GraphicsProject/Debug/../GraphicsProject.cpp:7: undefined reference to `Magick::Image::pixelColor(unsigned int, unsigned int, Magick::Color const&)'
C:/Users/dru/workspace/GraphicsProject/Debug/../GraphicsProject.cpp:7: undefined reference to `Magick::Color::~Color()'
C:/Users/dru/workspace/GraphicsProject/Debug/../GraphicsProject.cpp:7: undefined reference to `Magick::Color::~Color()'
C:/Users/dru/workspace/GraphicsProject/Debug/../GraphicsProject.cpp:8: undefined reference to `Magick::Image::write(std::string const&)'
C:/Users/dru/workspace/GraphicsProject/Debug/../GraphicsProject.cpp:9: undefined reference to `Magick::Image::~Image()'
C:/Users/dru/workspace/GraphicsProject/Debug/../GraphicsProject.cpp:9: undefined reference to `Magick::Image::~Image()'
collect2: ld returned 1 exit status
Build error occurred, build is stopped
Time consumed: 1108  ms.  


Those are my current settings:

Project->Properties->C/C++ General->Paths and Symbols:

Includes:
C:/msys/1.0/local/include/GraphicsMagick
C:/msys/1.0/local/include/GraphicsMagick/Magick++
C:/msys/1.0/local/include/GraphicsMagick/magick

Library Paths:
C:\msys\1.0\local\lib
C:\msys\1.0\local\bin
C:\MinGW\GnuWin32\lib
C:\MinGW\GnuWin32\bin
C:\MinGW\GraphicsMagick-1.3.7\

I was also trying to add directories to PATH in
Project->Properties->C/C++ Build->Environment:
C:\mingw\bin;C:\msys\1.0\local\lib;C:\msys\1.0\local\bin;C:\ mingw\GnuWin32\bin
but without any success..

I also added -l options in:
Project->Properties->C/C++ Build->Settings->Tool Settings(tab):
MinGW C++ Linker --> Shared Library Settings --> Import Library Name


Any help greatly appreciated!


[Updated on: Mon, 28 December 2009 09:04]

Report message to a moderator

Re: GraphicsMagick on Eclipse [message #505163 is a reply to message #505158] Mon, 28 December 2009 09:19 Go to previous messageGo to next message
aykay78  is currently offline aykay78 Friend
Messages: 2
Registered: December 2009
Junior Member
I've probably found the culprit:

I should have gone to:

Project->Properties->C/C++ Build->Settings->Tool Settings(tab):
MinGW C++ Linker -->Libraries (and NOT: Shared Library Settings)

and enter in Libraries -l - the specific libraries...
GraphicsMagick++
GraphicsMagick
tiff
jpeg
....




Re: GraphicsMagick on Eclipse [message #1747503 is a reply to message #505158] Tue, 15 November 2016 14:20 Go to previous message
Joyita Das is currently offline Joyita DasFriend
Messages: 4
Registered: November 2016
Junior Member
Hi, I am a newcomer too to Image Magick and I am trying to integrate it to Eclipse. I have included the header files and the the library files in linker but i am still getting the error-

4:09:21 **** Incremental Build of configuration Debug for project magickTest ****
Info: Internal Builder is used for build
g++ "-IC:\\Development\\ImageMagick-7.0.3-Q8\\include" -O0 -g3 -Wall -c -fmessage-length=0 -o "src\\zoom.o" "..\\src\\zoom.cpp" 
In file included from C:\Development\ImageMagick-7.0.3-Q8\include/MagickCore/magick-config.h:25:0,
                 from C:\Development\ImageMagick-7.0.3-Q8\include/Magick++/Include.h:14,
                 from C:\Development\ImageMagick-7.0.3-Q8\include/Magick++.h:10,
                 from ..\src\zoom.cpp:8:
C:\Development\ImageMagick-7.0.3-Q8\include/MagickCore/magick-baseconfig.h:438:0: warning: ignoring #pragma warning  [-Wunknown-pragmas]
 #pragma warning(once: 4100) /* 'identifier' : unreferenced formal parameter */
 ^
C:\Development\ImageMagick-7.0.3-Q8\include/MagickCore/magick-baseconfig.h:439:0: warning: ignoring #pragma warning  [-Wunknown-pragmas]
 #pragma warning(once: 4456) /* 'identifier' : declaration of 'foo' hides previous local declaration */
 ^
C:\Development\ImageMagick-7.0.3-Q8\include/MagickCore/magick-baseconfig.h:440:0: warning: ignoring #pragma warning  [-Wunknown-pragmas]
 #pragma warning(once: 4459) /* 'identifier' : declaration of 'foo' hides global declaration */
 ^
g++ "-LC:\\Development\\ImageMagick-7.0.3-Q8\\lib" -o magickTest.exe "src\\zoom.o" -lCORE_RL_Magick++_ -lCORE_RL_MagickWand_ -lCORE_RL_MagickCore_ 
src\zoom.o: In function `main':
C:\Development\Workspace\magickTest\Debug/../src/zoom.cpp:18: undefined reference to `Magick::Image::Image()'
C:\Development\Workspace\magickTest\Debug/../src/zoom.cpp:19: undefined reference to `Magick::Image::read(std::string const&)'
C:\Development\Workspace\magickTest\Debug/../src/zoom.cpp:20: undefined reference to `Magick::Image::write(std::string const&)'
C:\Development\Workspace\magickTest\Debug/../src/zoom.cpp:22: undefined reference to `Magick::Image::~Image()'
C:\Development\Workspace\magickTest\Debug/../src/zoom.cpp:22: undefined reference to `Magick::Image::~Image()'
collect2.exe: error: ld returned 1 exit status

14:09:22 Build Finished (took 686ms)



And below is my simple program-
#include <Magick++.h>
#include <iostream>
#include <string>


using namespace std;
using namespace Magick;

int main(int argc, char**argv){

	Image img;
	img.read("Image/happy-fish.jpg");
	img.write("Image/fish.png");

	return 0;
}


Can you please tell me how do i solve it.

[Updated on: Tue, 15 November 2016 15:51]

Report message to a moderator

Previous Topic:cdt do not open C/C++ perspective / ubuntu
Next Topic:GCC MinGW Compiler Settings
Goto Forum:
  


Current Time: Sat Jan 29 03:32:41 GMT 2022

Powered by FUDForum. Page generated in 0.02266 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top