newbie needs help compiling a simple Magick++ program
Posted: 2009-04-09T07:56:48-07:00
hi,
I've got a bit of experience with PHP, Java, etc., but new to C++. I'm just trying to compile one of the test programs found in Magick++. I am using ubuntu linux , Eclipse 3.2.2, and CDT 3.1.2. here is what I have done so far.
- File>New>Managed Make C++ project
- File>New>Source File, created a new file main.cpp
- copy/paste code from ./ImageMagick-6.5.1-0/Magick++/tests/readWriteImages.cpp to main.cpp
- Project>Properties>C/C++ Build>GCC C++ Linker > Miscellaneous>Linker Flags, added
- Project>Properties>C/C++ Build>GCC C++ Compiler>Directories, added
- When I "Build Project" I get the following output
- right click on main.cpp, choose Properties>C/C++ Build>GCC C++ Compiler>Directories, added
Now when I "Build Project" the compiler finds Magick++.h, but I get these errors:
Can someone offer a suggestion as to what I'm doing wrong?
Many thanks.
I've got a bit of experience with PHP, Java, etc., but new to C++. I'm just trying to compile one of the test programs found in Magick++. I am using ubuntu linux , Eclipse 3.2.2, and CDT 3.1.2. here is what I have done so far.
- File>New>Managed Make C++ project
- File>New>Source File, created a new file main.cpp
- copy/paste code from ./ImageMagick-6.5.1-0/Magick++/tests/readWriteImages.cpp to main.cpp
Code: Select all
// This may look like C code, but it is really -*- C++ -*-
//
// Copyright Bob Friesenhahn, 1999, 2000, 2003
//
// Test STL readImages and writeImages functions
//
#include <Magick++.h>
#include <string>
#include <iostream>
#include <list>
#include <vector>
using namespace std;
using namespace Magick;
int main( int /*argc*/, char ** argv)
{
// Initialize ImageMagick install location for Windows
InitializeMagick(*argv);
int failures=0;
[ plus a bit more...]
Code: Select all
`Magick++-config --cppflags --cxxflags --ldflags --libs`
Code: Select all
/path/to/ImageMagick-6.5.1-0/Magick++/lib
Code: Select all
**** Build of configuration Debug for project test ****
make -k all
Building file: ../main.cpp
Invoking: GCC C++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"main.d" -MT"main.d" -o"main.o" "../main.cpp"
../main.cpp:8:22: error: Magick++.h: No such file or directory
...
Code: Select all
/path/to/ImageMagick-6.5.1-0/Magick++/lib
Code: Select all
from ../main.cpp:8:
/path/to/ImageMagick-6.5.1-0/Magick++/lib/Magick++/Image.h:88: error: expected ‘,’ or ‘...’ before ‘type_’
/path/to/ImageMagick-6.5.1-0/Magick++/lib/Magick++/Image.h:89: error: ISO C++ forbids declaration of ‘StorageType’ with no type
/path/to/ImageMagick-6.5.1-0/Magick++/lib/Magick++/Image.h:125: error: expected ‘,’ or ‘...’ before ‘noiseType_’
/path/to/ImageMagick-6.5.1-0/Magick++/lib/Magick++/Image.h:125: error: ISO C++ forbids declaration of ‘NoiseType’ with no type
/path/to/ImageMagick-6.5.1-0/Magick++/lib/Magick++/Image.h:126: error: expected ‘,’ or ‘...’ before ‘channel_’
/path/to/ImageMagick-6.5.1-0/Magick++/lib/Magick++/Image.h:127: error: ISO C++ forbids declaration of ‘ChannelType’ with no type
/path/to/ImageMagick-6.5.1-0/Magick++/lib/Magick++/Image.h:154: error: expected ‘,’ or ‘...’ before ‘gravity_’
/path/to/ImageMagick-6.5.1-0/Magick++/lib/Magick++/Image.h:154: error: ISO C++ forbids declaration of ‘GravityType’ with no type
/path/to/ImageMagick-6.5.1-0/Magick++/lib/Magick++/Image.h:159: error: expected ‘,’ or ‘...’ before ‘gravity_’
/path/to/ImageMagick-6.5.1-0/Magick++/lib/Magick++/Image.h:160: error: ISO C++ forbids declaration of ‘GravityType’ with no type
/path/to/ImageMagick-6.5.1-0/Magick++/lib/Magick++/Image.h:160: error: ‘void Magick::Image::annotate(const std::string&, const Magick::Geometry&, int)’ cannot be overloaded
/path/to/ImageMagick-6.5.1-0/Magick++/lib/Magick++/Image.h:154: error: with ‘void Magick::Image::annotate(const std::string&, const Magick::Geometry&, int)’
/path/to/ImageMagick-6.5.1-0/Magick++/lib/Magick++/Image.h:164: error: expected ‘,’ or ‘...’ before ‘gravity_’
/path/to/ImageMagick-6.5.1-0/Magick++/lib/Magick++/Image.h:164: error: ISO C++ forbids declaration of ‘GravityType’ with no type
[ a whole lot more...]
../main.cpp:48: instantiated from here
/path/to/ImageMagick-6.5.1-0/Magick++/lib/Magick++/STL.h:1764: error: ‘class Magick::Image’ has no member named ‘image’
/path/to/ImageMagick-6.5.1-0/Magick++/lib/Magick++/STL.h: In function ‘void Magick::unlinkImages(InputIterator, InputIterator) [with InputIterator = std::_List_iterator<Magick::Image>]’:
/path/to/ImageMagick-6.5.1-0/Magick++/lib/Magick++/STL.h:2344: instantiated from ‘void Magick::writeImages(InputIterator, InputIterator, const std::string&, bool) [with InputIterator = std::_List_iterator<Magick::Image>]’
../main.cpp:48: instantiated from here
/path/to/ImageMagick-6.5.1-0/Magick++/lib/Magick++/STL.h:1787: error: ‘class Magick::Image’ has no member named ‘image’
make: *** [main.o] Error 1
make: Target `all' not remade because of errors.
Build complete for project test
Many thanks.