Author Topic: C::B With IM  (Read 14782 times)

Offline kirash4

  • Multiple posting newcomer
  • *
  • Posts: 42
C::B With IM
« on: April 06, 2014, 05:53:10 am »
Ok, this is rather silly. I can't seem to get C::B to compile anything using ImageMagick. Folks on here point fingers at ImageMagick, and the ImageMagick folks point their finger back to C::B. I've seen so many different posts of people trying all manners of options and configuration and I tried them all, nothing works. I don't understand why it's so hard to make it work. I have zero problems on my unix platform: compile IM, install the headers, write my c++ program, compile and link it against IM. Done. It works.

I've spent the better part of this past week fighting with C::B and IM and nothing. I hate having to write my code in C::B, save it to my unix server just to compile it there. And I don't fancy setting up a cross-compiler environment just so I can create Win32 applications. That's the whole reason I'm trying to use C::B with, hopefully, wxWidgets. But I need ImageMagick support as well.

So, has anyone been able to successfully compile code with IM support, using C::B? If so, what steps did you follow? What version of IM did you install, or did you compile it from sources (and if so, did you use C::B to compile it?) What settings did you have to set in C::B to make it work? No matter of options, that I've seen online, appear to work, in the end the linker always fails with unresolved symbols that would normally be there if it links properly.


Offline kirash4

  • Multiple posting newcomer
  • *
  • Posts: 42
Re: C::B With IM
« Reply #2 on: April 06, 2014, 10:31:39 pm »
I feel I'm starting yet another dead-end thread as I have yet to find a solution on these forums or elsewhere. Everyone posts the errors, no one has an answer. But, since you pointed me to that page, let's see if that's all you can help with:

-----

I am running Code::Blocks version 13.12 on Windows
(Windows 7 Ultimate 64-bit). The compiler I use is MinGW
version 4.7.1 32-bit.  <-- the one that comes with C::B.

When I ...
Simply can't finish a compile of anything that requires to be linked against the ImageMagick library. Other code that does not use IM compiles fine, no problems. That tells me the compiler itself is working fine. It's merely the final linking step, against IM, that doesn't appear to work, or rather, I can't figure out how it should be configured to work.

Description of problem.
C::B compiles the .o object file but then fails to link it to create the final executable.

Build log:
Code: [Select]
mingw32-g++.exe -O2 -I"C:\Program Files\ImageMagick-6.8.8-Q16\include" -c T:\povpoi\arc.cpp -o T:\povpoi\arc.o
mingw32-g++.exe -L"C:\Program Files\ImageMagick-6.8.8-Q16\lib" -o T:\povpoi\arc.exe T:\povpoi\arc.o   "C:\Program Files\ImageMagick-6.8.8-Q16\lib\CORE_RL_magick_.lib" "C:\Program Files\ImageMagick-6.8.8-Q16\lib\CORE_RL_Magick++_.lib" "C:\Program Files\ImageMagick-6.8.8-Q16\lib\CORE_RL_wand_.lib"
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x84): undefined reference to `Magick::InitializeMagick(char const*)'
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x249): undefined reference to `Magick::Image::Image(std::string const&)'
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x26a): undefined reference to `Magick::Image::constImage() const'
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x2c8): undefined reference to `Magick::Image::unsharpmask(double, double, double, double)'
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x2ed): undefined reference to `Magick::Color::Color(unsigned short, unsigned short, unsigned short)'
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x305): undefined reference to `Magick::Image::constImage() const'
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x344): undefined reference to `Magick::Geometry::Geometry(unsigned int, unsigned int, int, int, bool, bool)'
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x36f): undefined reference to `Magick::Image::extent(Magick::Geometry const&, Magick::Color const&)'
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x387): undefined reference to `Magick::Geometry::~Geometry()'
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x392): undefined reference to `Magick::Image::constImage() const'
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x3d2): undefined reference to `Magick::Geometry::Geometry(unsigned int, unsigned int, int, int, bool, bool)'
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x3f3): undefined reference to `Magick::Image::size(Magick::Geometry const&)'
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x409): undefined reference to `Magick::Geometry::~Geometry()'
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x41b): undefined reference to `Magick::Image::virtualPixelMethod(MagickCore::VirtualPixelMethod)'
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x45c): undefined reference to `Magick::Image::distort(MagickCore::DistortImageMethod, unsigned int, double const*, bool)'
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x471): undefined reference to `Magick::Image::virtualPixelMethod(MagickCore::VirtualPixelMethod)'
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x4b0): undefined reference to `Magick::Image::distort(MagickCore::DistortImageMethod, unsigned int, double const*, bool)'
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x4be): undefined reference to `Magick::Image::constImage() const'
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x4d5): undefined reference to `Magick::Image::constImage() const'
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x513): undefined reference to `Magick::Geometry::Geometry(unsigned int, unsigned int, int, int, bool, bool)'
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x546): undefined reference to `Magick::Image::extent(Magick::Geometry const&, Magick::Color const&, MagickCore::GravityType)'
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x55e): undefined reference to `Magick::Geometry::~Geometry()'
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x572): undefined reference to `Magick::Image::write(std::string const&)'
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x588): undefined reference to `Magick::Color::~Color()'
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x59d): undefined reference to `Magick::Image::~Image()'
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x601): undefined reference to `Magick::Geometry::Geometry(char const*)'
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x620): undefined reference to `Magick::Image::resize(Magick::Geometry const&)'
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x636): undefined reference to `Magick::Geometry::~Geometry()'
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x8bf): undefined reference to `Magick::Geometry::~Geometry()'
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x8d4): undefined reference to `Magick::Color::~Color()'
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x8e9): undefined reference to `Magick::Image::~Image()'
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x903): undefined reference to `Magick::Geometry::~Geometry()'
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x91a): undefined reference to `Magick::Geometry::~Geometry()'
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x931): undefined reference to `Magick::Geometry::~Geometry()'
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 1 second(s))
34 error(s), 0 warning(s) (0 minute(s), 1 second(s))

Crash report:
Code: [Select]
Code::Blocks did not crash.

    (Although the following is not necessary, showing that you
     have tried increases the probability of a response.)
I have already tried ...
Every error report I've read/seen online pointed to needing to add the libraries and search paths in C::B, which I have done. When I don't do that, the compiler immediately stops because it can't find 'Magick++.h', so that tells me that at least *some* of the configuration is working, but there's still something missing. So here it is, one at a time:

- Settings->Compiler...
- Under 'Linker Settings' I added the libraries:
Code: [Select]
C:\Program Files\ImageMagick-6.8.8-Q16\lib\CORE_RL_magick_.lib
C:\Program Files\ImageMagick-6.8.8-Q16\lib\CORE_RL_Magick++_.lib
C:\Program Files\ImageMagick-6.8.8-Q16\lib\CORE_RL_wand_.lib
- 'Other linker options' is empty.
- Under 'Search directories -> Compiler', I added:
Code: [Select]
C:\Program Files\ImageMagick-6.8.8-Q16\include- Under 'Search directories -> Linker', I added:
Code: [Select]
C:\Program Files\ImageMagick-6.8.8-Q16\lib
That's all of it.

As for compiling the code from the command line, it won't work in a Win32 shell because IM does not provide a 'Magick++-config' for Win32 platforms. However, in a cygwin environment it compiles fine. On a unix platform, it compiles fine. The command line used in those environments is:
Code: [Select]
c++ -O2 <file>.cpp -o <compiled-binary> `Magick++-config --cppflags --cxxflags --ldflags --libs`

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2552
Re: C::B With IM
« Reply #3 on: April 06, 2014, 10:48:13 pm »
This is a nice compiler error report  from you. It is uncommon to see something complete ;) .

I have no idea what Image hack is nor have i worked with it. But i can give you some general linker hints. gcc is a bit annoying with the order of the libraries. So try to rearrange the libraries in 'Linker Settings'. This are only 3 libraries, so you can try every combination ;)

greetings

Offline kirash4

  • Multiple posting newcomer
  • *
  • Posts: 42
Re: C::B With IM
« Reply #4 on: April 06, 2014, 11:01:23 pm »
I've gone through every permutation of the order and it always fails with the same exact thing. For that matter, if I completely remove the libraries from 'Linker settings' the error remains the same. It's as if it completely ignores the libraries. I don't know if there are linker options I need to be setting (and if so, what they would be.)

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: C::B With IM
« Reply #5 on: April 06, 2014, 11:03:19 pm »
See

http://www.imagemagick.org/discourse-server/viewtopic.php?f=2&t=22571#p94136

You can use those imagemagick-config commands as other options in the compiler and linker settings of your project (by enclosing them in back quotes) and they will passed to gcc

Offline kirash4

  • Multiple posting newcomer
  • *
  • Posts: 42
Re: C::B With IM
« Reply #6 on: April 06, 2014, 11:11:18 pm »
All of what's on that page is done on a unix environment. MagickWand-config doesn't exist on the Windows platform. But since I have a unix environment available:
Code: [Select]
MagickWand-config --cflags --cppflags
-fopenmp -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/usr/local/include/ImageMagick-6
-fopenmp -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/usr/local/include/ImageMagick-6

And:
Code: [Select]
MagickWand-config --ldflags --libs
-L/usr/local/lib -lMagickWand-6.Q16 -lMagickCore-6.Q16
-L/usr/local/lib -lMagickWand-6.Q16 -lMagickCore-6.Q16

So what should I be adding to the linker options?

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2552
Re: C::B With IM
« Reply #7 on: April 06, 2014, 11:14:10 pm »
You can use those imagemagick-config commands as other options in the compiler and linker settings of your project (by enclosing them in back quotes) and they will passed to gcc

i think on windows this won't work easily...

I've gone through every permutation of the order and it always fails with the same exact thing. For that matter, if I completely remove the libraries from 'Linker settings' the error remains the same. It's as if it completely ignores the libraries. I don't know if there are linker options I need to be setting (and if so, what they would be.)

i reread your log, and i think you added the libraries in the wrong field, because there is no -l at the beginning of the library names:
you have to add the libraries in Project->Build Options->Linker Settings->Link libraries

greetings

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: C::B With IM
« Reply #8 on: April 06, 2014, 11:17:46 pm »
In the one I downloaded here: http://www.imagemagick.org/script/binary-releases.php

MagicWand-config exists, but it's a bash script, so you need some sort of bash scripting environment installed, which I think ships with modern mingws...

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: C::B With IM
« Reply #9 on: April 06, 2014, 11:18:25 pm »
You can use those imagemagick-config commands as other options in the compiler and linker settings of your project (by enclosing them in back quotes) and they will passed to gcc

i think on windows this won't work easily...

What doesn't work? Backtick substitutions in C::B work fine on windows and linux.

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2552
Re: C::B With IM
« Reply #10 on: April 06, 2014, 11:20:12 pm »
You can use those imagemagick-config commands as other options in the compiler and linker settings of your project (by enclosing them in back quotes) and they will passed to gcc

i think on windows this won't work easily...

What doesn't work? Backtick substitutions in C::B work fine on windows and linux.
the unix build script with windows

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7265
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: C::B With IM
« Reply #11 on: April 06, 2014, 11:21:46 pm »
All of what's on that page is done on a unix environment. MagickWand-config doesn't exist on the Windows platform. But since I have a unix environment available:
Code: [Select]
MagickWand-config --cflags --cppflags
-fopenmp -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/usr/local/include/ImageMagick-6
-fopenmp -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/usr/local/include/ImageMagick-6

And:
Code: [Select]
MagickWand-config --ldflags --libs
-L/usr/local/lib -lMagickWand-6.Q16 -lMagickCore-6.Q16
-L/usr/local/lib -lMagickWand-6.Q16 -lMagickCore-6.Q16

So what should I be adding to the linker options?
I would try adding the path to the lib-folder to the libraries search-path and the name of the libs without path and extension to the link-library list.
If the libs are compiled with c and not c++ you might get problems because of name mangling, if they are compiled with/for cygwin, they might not work at all with gcc.
For the name mangling problem (if you do not already know how to fix) search for "name mangling extern c" (https://duckduckgo.com/?q=name+mangling+extern+c).

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: C::B With IM
« Reply #12 on: April 06, 2014, 11:25:57 pm »
the unix build script with windows

hmm... it looks like it needs pkg-config, which you can get on windows but takes a bit of work (e.g. you need gtk for some strange reason)

i reread your log, and i think you added the libraries in the wrong field, because there is no -l at the beginning of the library names:
you have to add the libraries in Project->Build Options->Linker Settings->Link libraries

Try this.

Offline kirash4

  • Multiple posting newcomer
  • *
  • Posts: 42
Re: C::B With IM
« Reply #13 on: April 06, 2014, 11:26:44 pm »
I'm doing it in the global compiler settings because I'm not actually working inside of a project, just a single c++ file. Basically I took the same file I compile on my unix environment and opened it in C::B.


Offline kirash4

  • Multiple posting newcomer
  • *
  • Posts: 42
Re: C::B With IM
« Reply #14 on: April 06, 2014, 11:29:48 pm »
In the one I downloaded here: http://www.imagemagick.org/script/binary-releases.php

MagicWand-config exists, but it's a bash script, so you need some sort of bash scripting environment installed, which I think ships with modern mingws...

Which specifically did you download? I grabbed 'ImageMagick-6.8.8-10-Q16-x64-dll.exe' and there is no MagickWand-config script, at least not in its install folder.

Offline kirash4

  • Multiple posting newcomer
  • *
  • Posts: 42
Re: C::B With IM
« Reply #15 on: April 06, 2014, 11:32:56 pm »
i reread your log, and i think you added the libraries in the wrong field, because there is no -l at the beginning of the library names:
you have to add the libraries in Project->Build Options->Linker Settings->Link libraries

Try this.

Ok, that produced a different error:
Code: [Select]
mingw32-g++.exe -O2 -I"C:\Program Files\ImageMagick-6.8.8-Q16\include" -c T:\povpoi\arc.cpp -o T:\povpoi\arc.o
mingw32-g++.exe -L"C:\Program Files\ImageMagick-6.8.8-Q16\lib" -o T:\povpoi\arc.exe T:\povpoi\arc.o   -lCORE_RL_Magick++_.lib -lCORE_RL_magick_.lib -lCORE_RL_wand_.lib
c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/../../../../mingw32/bin/ld.exe: cannot find -lCORE_RL_Magick++_.lib
c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/../../../../mingw32/bin/ld.exe: cannot find -lCORE_RL_magick_.lib
c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/../../../../mingw32/bin/ld.exe: cannot find -lCORE_RL_wand_.lib
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 0 second(s))
3 error(s), 0 warning(s) (0 minute(s), 0 second(s))

So evidently it does need the full path on the libraries. I did make sure to add it in the linker search path by the way.

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: C::B With IM
« Reply #16 on: April 06, 2014, 11:40:01 pm »
Try without the .lib extension

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2552
Re: C::B With IM
« Reply #17 on: April 06, 2014, 11:43:35 pm »
I can't recommend to work without a project. This makes always problems...

if dmoore's tip don't help try this:

Add the compiler option -v in Project->build options->Compiler settings->Other options and Project->build options->Linker settings->Other Linker options and make a rebuild (Build->Rebuild)
this will give you a detailed description of your paths and errors... If you can't find the error you can post the full rebuild log here

greetings

Offline kirash4

  • Multiple posting newcomer
  • *
  • Posts: 42
Re: C::B With IM
« Reply #18 on: April 06, 2014, 11:44:21 pm »
Try without the .lib extension
No dice, back to original errors:
Code: [Select]
mingw32-g++.exe -O2 -I"C:\Program Files\ImageMagick-6.8.8-Q16\include" -c T:\povpoi\arc.cpp -o T:\povpoi\arc.o
mingw32-g++.exe -L"C:\Program Files\ImageMagick-6.8.8-Q16\lib" -o T:\povpoi\arc.exe T:\povpoi\arc.o   -lCORE_RL_Magick++_ -lCORE_RL_magick_ -lCORE_RL_wand_
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x84): undefined reference to `Magick::InitializeMagick(char const*)'
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x249): undefined reference to `Magick::Image::Image(std::string const&)'
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x26a): undefined reference to `Magick::Image::constImage() const'
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x2c8): undefined reference to `Magick::Image::unsharpmask(double, double, double, double)'
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x2ed): undefined reference to `Magick::Color::Color(unsigned short, unsigned short, unsigned short)'
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x305): undefined reference to `Magick::Image::constImage() const'
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x344): undefined reference to `Magick::Geometry::Geometry(unsigned int, unsigned int, int, int, bool, bool)'
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x36f): undefined reference to `Magick::Image::extent(Magick::Geometry const&, Magick::Color const&)'
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x387): undefined reference to `Magick::Geometry::~Geometry()'
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x392): undefined reference to `Magick::Image::constImage() const'
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x3d2): undefined reference to `Magick::Geometry::Geometry(unsigned int, unsigned int, int, int, bool, bool)'
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x3f3): undefined reference to `Magick::Image::size(Magick::Geometry const&)'
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x409): undefined reference to `Magick::Geometry::~Geometry()'
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x41b): undefined reference to `Magick::Image::virtualPixelMethod(MagickCore::VirtualPixelMethod)'
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x45c): undefined reference to `Magick::Image::distort(MagickCore::DistortImageMethod, unsigned int, double const*, bool)'
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x471): undefined reference to `Magick::Image::virtualPixelMethod(MagickCore::VirtualPixelMethod)'
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x4b0): undefined reference to `Magick::Image::distort(MagickCore::DistortImageMethod, unsigned int, double const*, bool)'
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x4be): undefined reference to `Magick::Image::constImage() const'
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x4d5): undefined reference to `Magick::Image::constImage() const'
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x513): undefined reference to `Magick::Geometry::Geometry(unsigned int, unsigned int, int, int, bool, bool)'
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x546): undefined reference to `Magick::Image::extent(Magick::Geometry const&, Magick::Color const&, MagickCore::GravityType)'
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x55e): undefined reference to `Magick::Geometry::~Geometry()'
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x572): undefined reference to `Magick::Image::write(std::string const&)'
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x588): undefined reference to `Magick::Color::~Color()'
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x59d): undefined reference to `Magick::Image::~Image()'
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x601): undefined reference to `Magick::Geometry::Geometry(char const*)'
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x620): undefined reference to `Magick::Image::resize(Magick::Geometry const&)'
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x636): undefined reference to `Magick::Geometry::~Geometry()'
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x8bf): undefined reference to `Magick::Geometry::~Geometry()'
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x8d4): undefined reference to `Magick::Color::~Color()'
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x8e9): undefined reference to `Magick::Image::~Image()'
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x903): undefined reference to `Magick::Geometry::~Geometry()'
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x91a): undefined reference to `Magick::Geometry::~Geometry()'
T:\povpoi\arc.o:arc.cpp:(.text.startup+0x931): undefined reference to `Magick::Geometry::~Geometry()'
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 1 second(s))
34 error(s), 0 warning(s) (0 minute(s), 1 second(s))

Offline kirash4

  • Multiple posting newcomer
  • *
  • Posts: 42
Re: C::B With IM
« Reply #19 on: April 06, 2014, 11:48:41 pm »
I can't recommend to work without a project. This makes always problems...

if dmoore's tip don't help try this:

Add the compiler option -v in Project->build options->Compiler settings->Other options and Project->build options->Linker settings->Other Linker options and make a rebuild (Build->Rebuild)
this will give you a detailed description of your paths and errors... If you can't find the error you can post the full rebuild log here

greetings
I can't do that because I'm not working inside of a project, so those options are all grayed out. So I'll have to create a new project and import the code and go from there. Give me a minute or two ...

Offline kirash4

  • Multiple posting newcomer
  • *
  • Posts: 42
Re: C::B With IM
« Reply #20 on: April 07, 2014, 12:01:14 am »
Here you go. This is following dmoore's suggestion of removing the path from the libraries as well as their extension, and setting (or rather keeping) the search path pointed where the libraries are. I'm seeing where it's searching, and those are correct paths:
Code: [Select]
-------------- Clean: Release in POVpoi (compiler: GNU GCC Compiler)---------------

Cleaned "POVpoi - Release"

-------------- Build: Release in POVpoi (compiler: GNU GCC Compiler)---------------

mingw32-g++.exe -Wall -fexceptions -O2 -v -O2 -I"C:\Program Files\ImageMagick-6.8.8-Q16\include" -c G:\Dropbox\CodeBlocks\POVpoi\arc.cpp -o obj\Release\arc.o
Using built-in specs.
COLLECT_GCC=mingw32-g++.exe
Target: mingw32
Configured with: ../../src/gcc-4.7.1/configure --build=mingw32 --enable-languages=c,c++,ada,fortran,objc,obj-c++ --enable-threads=win32 --enable-libgomp --enable-lto --enable-fully-dynamic-string --enable-libstdcxx-debug --enable-version-specific-runtime-libs --with-gnu-ld --disable-nls --disable-win32-registry --disable-symvers --disable-build-poststage1-with-cxx --disable-werror --prefix=/mingw32tdm --with-local-prefix=/mingw32tdm --enable-cxx-flags='-fno-function-sections -fno-data-sections' --with-pkgversion=tdm-1 --enable-sjlj-exceptions --with-bugurl=http://tdm-gcc.tdragon.net/bugs
Thread model: win32
gcc version 4.7.1 (tdm-1)
COLLECT_GCC_OPTIONS='-Wall' '-fexceptions' '-O2' '-v' '-O2' '-I' 'C:\Program Files\ImageMagick-6.8.8-Q16\include' '-c' '-o' 'obj\Release\arc.o' '-mtune=i386' '-march=i386'
 c:/program files (x86)/codeblocks/mingw/bin/../libexec/gcc/mingw32/4.7.1/cc1plus.exe -quiet -v -I C:\Program Files\ImageMagick-6.8.8-Q16\include -iprefix c:\program files (x86)\codeblocks\mingw\bin\../lib/gcc/mingw32/4.7.1/ G:\Dropbox\CodeBlocks\POVpoi\arc.cpp -quiet -dumpbase arc.cpp -mtune=i386 -march=i386 -auxbase-strip obj\Release\arc.o -O2 -O2 -Wall -version -fexceptions -o C:\Users\ASHLEY~1.KIR\AppData\Local\Temp\cc36P96r.s
GNU C++ (tdm-1) version 4.7.1 (mingw32)
compiled by GNU C version 4.7.1, GMP version 4.3.2, MPFR version 2.4.2, MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "c:\program files (x86)\codeblocks\mingw\bin\../lib/gcc/mingw32/4.7.1/../../../../mingw32/include"
ignoring duplicate directory "c:/program files (x86)/codeblocks/mingw/lib/gcc/../../lib/gcc/mingw32/4.7.1/include/c++"
ignoring duplicate directory "c:/program files (x86)/codeblocks/mingw/lib/gcc/../../lib/gcc/mingw32/4.7.1/include/c++/mingw32"
ignoring duplicate directory "c:/program files (x86)/codeblocks/mingw/lib/gcc/../../lib/gcc/mingw32/4.7.1/include/c++/backward"
ignoring duplicate directory "c:/program files (x86)/codeblocks/mingw/lib/gcc/../../lib/gcc/mingw32/4.7.1/include"
ignoring duplicate directory "c:/program files (x86)/codeblocks/mingw/lib/gcc/../../lib/gcc/mingw32/4.7.1/../../../../include"
ignoring duplicate directory "c:/program files (x86)/codeblocks/mingw/lib/gcc/../../lib/gcc/mingw32/4.7.1/include-fixed"
ignoring nonexistent directory "c:/program files (x86)/codeblocks/mingw/lib/gcc/../../lib/gcc/mingw32/4.7.1/../../../../mingw32/include"
#include "..." search starts here:
#include <...> search starts here:
 C:\Program Files\ImageMagick-6.8.8-Q16\include
 c:\program files (x86)\codeblocks\mingw\bin\../lib/gcc/mingw32/4.7.1/include/c++
 c:\program files (x86)\codeblocks\mingw\bin\../lib/gcc/mingw32/4.7.1/include/c++/mingw32
 c:\program files (x86)\codeblocks\mingw\bin\../lib/gcc/mingw32/4.7.1/include/c++/backward
 c:\program files (x86)\codeblocks\mingw\bin\../lib/gcc/mingw32/4.7.1/include
 c:\program files (x86)\codeblocks\mingw\bin\../lib/gcc/mingw32/4.7.1/../../../../include
 c:\program files (x86)\codeblocks\mingw\bin\../lib/gcc/mingw32/4.7.1/include-fixed
End of search list.
GNU C++ (tdm-1) version 4.7.1 (mingw32)
compiled by GNU C version 4.7.1, GMP version 4.3.2, MPFR version 2.4.2, MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 1b05afeca9d712f769248af52f554d5e
COLLECT_GCC_OPTIONS='-Wall' '-fexceptions' '-O2' '-v' '-O2' '-I' 'C:\Program Files\ImageMagick-6.8.8-Q16\include' '-c' '-o' 'obj\Release\arc.o' '-mtune=i386' '-march=i386'
 c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/../../../../mingw32/bin/as.exe -v -I C:\Program Files\ImageMagick-6.8.8-Q16\include -o obj\Release\arc.o C:\Users\ASHLEY~1.KIR\AppData\Local\Temp\cc36P96r.s
GNU assembler version 2.22 (mingw32) using BFD version (GNU Binutils) 2.22
COMPILER_PATH=c:/program files (x86)/codeblocks/mingw/bin/../libexec/gcc/mingw32/4.7.1/;c:/program files (x86)/codeblocks/mingw/bin/../libexec/gcc/;c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/../../../../mingw32/bin/
LIBRARY_PATH=c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/;c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/;c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/../../../../mingw32/lib/;c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/../../../
COLLECT_GCC_OPTIONS='-Wall' '-fexceptions' '-O2' '-v' '-O2' '-I' 'C:\Program Files\ImageMagick-6.8.8-Q16\include' '-c' '-o' 'obj\Release\arc.o' '-mtune=i386' '-march=i386'
mingw32-g++.exe -L"C:\Program Files\ImageMagick-6.8.8-Q16\lib" -o bin\Release\POVpoi.exe obj\Release\arc.o  -s -v  -lCORE_RL_Magick++_ -lCORE_RL_magick_ -lCORE_RL_wand_
Using built-in specs.
COLLECT_GCC=mingw32-g++.exe
COLLECT_LTO_WRAPPER=c:/program files (x86)/codeblocks/mingw/bin/../libexec/gcc/mingw32/4.7.1/lto-wrapper.exe
Target: mingw32
Configured with: ../../src/gcc-4.7.1/configure --build=mingw32 --enable-languages=c,c++,ada,fortran,objc,obj-c++ --enable-threads=win32 --enable-libgomp --enable-lto --enable-fully-dynamic-string --enable-libstdcxx-debug --enable-version-specific-runtime-libs --with-gnu-ld --disable-nls --disable-win32-registry --disable-symvers --disable-build-poststage1-with-cxx --disable-werror --prefix=/mingw32tdm --with-local-prefix=/mingw32tdm --enable-cxx-flags='-fno-function-sections -fno-data-sections' --with-pkgversion=tdm-1 --enable-sjlj-exceptions --with-bugurl=http://tdm-gcc.tdragon.net/bugs
Thread model: win32
gcc version 4.7.1 (tdm-1)
COMPILER_PATH=c:/program files (x86)/codeblocks/mingw/bin/../libexec/gcc/mingw32/4.7.1/;c:/program files (x86)/codeblocks/mingw/bin/../libexec/gcc/;c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/../../../../mingw32/bin/
LIBRARY_PATH=c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/;c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/;c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/../../../../mingw32/lib/;c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/../../../
COLLECT_GCC_OPTIONS='-LC:\Program Files\ImageMagick-6.8.8-Q16\lib' '-o' 'bin\Release\POVpoi.exe' '-s' '-v' '-mtune=i386' '-march=i386'
 c:/program files (x86)/codeblocks/mingw/bin/../libexec/gcc/mingw32/4.7.1/collect2.exe -Bdynamic -o bin\Release\POVpoi.exe -s c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/../../../crt2.o c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/crtbegin.o -LC:\Program Files\ImageMagick-6.8.8-Q16\lib -Lc:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1 -Lc:/program files (x86)/codeblocks/mingw/bin/../lib/gcc -Lc:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/../../../../mingw32/lib -Lc:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/../../.. obj\Release\arc.o -lCORE_RL_Magick++_ -lCORE_RL_magick_ -lCORE_RL_wand_ -Bstatic -lstdc++ -Bdynamic -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt -ladvapi32 -lshell32 -luser32 -lkernel32 -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/crtend.o
obj\Release\arc.o:arc.cpp:(.text.startup+0x84): undefined reference to `Magick::InitializeMagick(char const*)'
obj\Release\arc.o:arc.cpp:(.text.startup+0x249): undefined reference to `Magick::Image::Image(std::string const&)'
obj\Release\arc.o:arc.cpp:(.text.startup+0x26a): undefined reference to `Magick::Image::constImage() const'
obj\Release\arc.o:arc.cpp:(.text.startup+0x2c8): undefined reference to `Magick::Image::unsharpmask(double, double, double, double)'
obj\Release\arc.o:arc.cpp:(.text.startup+0x2ed): undefined reference to `Magick::Color::Color(unsigned short, unsigned short, unsigned short)'
obj\Release\arc.o:arc.cpp:(.text.startup+0x305): undefined reference to `Magick::Image::constImage() const'
obj\Release\arc.o:arc.cpp:(.text.startup+0x344): undefined reference to `Magick::Geometry::Geometry(unsigned int, unsigned int, int, int, bool, bool)'
obj\Release\arc.o:arc.cpp:(.text.startup+0x36f): undefined reference to `Magick::Image::extent(Magick::Geometry const&, Magick::Color const&)'
obj\Release\arc.o:arc.cpp:(.text.startup+0x387): undefined reference to `Magick::Geometry::~Geometry()'
obj\Release\arc.o:arc.cpp:(.text.startup+0x392): undefined reference to `Magick::Image::constImage() const'
obj\Release\arc.o:arc.cpp:(.text.startup+0x3d2): undefined reference to `Magick::Geometry::Geometry(unsigned int, unsigned int, int, int, bool, bool)'
obj\Release\arc.o:arc.cpp:(.text.startup+0x3f3): undefined reference to `Magick::Image::size(Magick::Geometry const&)'
obj\Release\arc.o:arc.cpp:(.text.startup+0x409): undefined reference to `Magick::Geometry::~Geometry()'
obj\Release\arc.o:arc.cpp:(.text.startup+0x41b): undefined reference to `Magick::Image::virtualPixelMethod(MagickCore::VirtualPixelMethod)'
obj\Release\arc.o:arc.cpp:(.text.startup+0x45c): undefined reference to `Magick::Image::distort(MagickCore::DistortImageMethod, unsigned int, double const*, bool)'
obj\Release\arc.o:arc.cpp:(.text.startup+0x471): undefined reference to `Magick::Image::virtualPixelMethod(MagickCore::VirtualPixelMethod)'
obj\Release\arc.o:arc.cpp:(.text.startup+0x4b0): undefined reference to `Magick::Image::distort(MagickCore::DistortImageMethod, unsigned int, double const*, bool)'
obj\Release\arc.o:arc.cpp:(.text.startup+0x4be): undefined reference to `Magick::Image::constImage() const'
obj\Release\arc.o:arc.cpp:(.text.startup+0x4d5): undefined reference to `Magick::Image::constImage() const'
obj\Release\arc.o:arc.cpp:(.text.startup+0x513): undefined reference to `Magick::Geometry::Geometry(unsigned int, unsigned int, int, int, bool, bool)'
obj\Release\arc.o:arc.cpp:(.text.startup+0x546): undefined reference to `Magick::Image::extent(Magick::Geometry const&, Magick::Color const&, MagickCore::GravityType)'
obj\Release\arc.o:arc.cpp:(.text.startup+0x55e): undefined reference to `Magick::Geometry::~Geometry()'
obj\Release\arc.o:arc.cpp:(.text.startup+0x572): undefined reference to `Magick::Image::write(std::string const&)'
obj\Release\arc.o:arc.cpp:(.text.startup+0x588): undefined reference to `Magick::Color::~Color()'
obj\Release\arc.o:arc.cpp:(.text.startup+0x59d): undefined reference to `Magick::Image::~Image()'
obj\Release\arc.o:arc.cpp:(.text.startup+0x601): undefined reference to `Magick::Geometry::Geometry(char const*)'
obj\Release\arc.o:arc.cpp:(.text.startup+0x620): undefined reference to `Magick::Image::resize(Magick::Geometry const&)'
obj\Release\arc.o:arc.cpp:(.text.startup+0x636): undefined reference to `Magick::Geometry::~Geometry()'
obj\Release\arc.o:arc.cpp:(.text.startup+0x8bf): undefined reference to `Magick::Geometry::~Geometry()'
obj\Release\arc.o:arc.cpp:(.text.startup+0x8d4): undefined reference to `Magick::Color::~Color()'
obj\Release\arc.o:arc.cpp:(.text.startup+0x8e9): undefined reference to `Magick::Image::~Image()'
obj\Release\arc.o:arc.cpp:(.text.startup+0x903): undefined reference to `Magick::Geometry::~Geometry()'
obj\Release\arc.o:arc.cpp:(.text.startup+0x91a): undefined reference to `Magick::Geometry::~Geometry()'
obj\Release\arc.o:arc.cpp:(.text.startup+0x931): undefined reference to `Magick::Geometry::~Geometry()'
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 1 second(s))
34 error(s), 0 warning(s) (0 minute(s), 1 second(s))
Build log saved as:
file://G:/Dropbox/CodeBlocks/POVpoi/POVpoi_build_log.html

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6666
    • My Best Post
Re: C::B With IM
« Reply #21 on: April 07, 2014, 12:11:29 am »
FYI:

The order of the libs in linking matter!

I suggest trying different orders of these three.

Code: [Select]
-lCORE_RL_Magick++_ -lCORE_RL_magick_ -lCORE_RL_wand_
Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline kirash4

  • Multiple posting newcomer
  • *
  • Posts: 42
Re: C::B With IM
« Reply #22 on: April 07, 2014, 12:30:14 am »
FYI:

The order of the libs in linking matter!

I suggest trying different orders of these three.

Code: [Select]
-lCORE_RL_Magick++_ -lCORE_RL_magick_ -lCORE_RL_wand_
Tim S.

That's what I'm seeing in the log file:
Code: [Select]
mingw32-g++.exe -L"C:\Program Files\ImageMagick-6.8.8-Q16\lib" -o bin\Release\POVpoi.exe obj\Release\arc.o  -s -v  -lCORE_RL_Magick++_ -lCORE_RL_magick_ -lCORE_RL_wand_

Offline osdt

  • Multiple posting newcomer
  • *
  • Posts: 61
Re: C::B With IM
« Reply #23 on: April 07, 2014, 12:35:39 am »
It looks like you are trying to link libraries (CORE_RL_magick_.lib, ...) built for MSVC. This will not work for MinGW as your toolchain. Is there any CORE*.a or CORE*.dll.a file in the lib-folder?

Offline kirash4

  • Multiple posting newcomer
  • *
  • Posts: 42
Re: C::B With IM
« Reply #24 on: April 07, 2014, 12:43:06 am »
It looks like you are trying to link libraries (CORE_RL_magick_.lib, ...) built for MSVC. This will not work for MinGW as your toolchain. Is there any CORE*.a or CORE*.dll.a file in the lib-folder?
Nope. So if this won't work with the MinGW toolchain with C::B, what would you suggest?

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: C::B With IM
« Reply #25 on: April 07, 2014, 12:52:40 am »
Get the mingw binary instead. (EDIT: it's confusingly listed under the Unix binaries... this is the one I had downloaded in my earlier posts)
« Last Edit: April 07, 2014, 12:56:41 am by dmoore »

Offline kirash4

  • Multiple posting newcomer
  • *
  • Posts: 42
Re: C::B With IM
« Reply #26 on: April 07, 2014, 01:01:50 am »
Get the mingw binary instead. (EDIT: it's confusingly listed under the Unix binaries... this is the one I had downloaded in my earlier posts)
Ok. This download doesn't have an actual installation, though am I correct in assuming all you're using that for is for linking against? Meaning, can I leave the regular installation in place?

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: C::B With IM
« Reply #27 on: April 07, 2014, 01:13:13 am »
Get the mingw binary instead. (EDIT: it's confusingly listed under the Unix binaries... this is the one I had downloaded in my earlier posts)
Ok. This download doesn't have an actual installation, though am I correct in assuming all you're using that for is for linking against? Meaning, can I leave the regular installation in place?

Yes, they should not clash. I think it's common to install these mingw bundles into your mingw folder (so bin ends up in C:\mingw\bin etc) but then it's hard to remove/upgrade outdated libs if you do that.

Offline kirash4

  • Multiple posting newcomer
  • *
  • Posts: 42
Re: C::B With IM
« Reply #28 on: April 07, 2014, 01:19:00 am »
Yeah, I can put them elsewhere and just point C::B to them, no biggy. Progress report: I was able to successfully compile my test program. A few warnings, but nothing of real consequence:
Code: [Select]
||=== Build: Release in POVpoi (compiler: GNU GCC Compiler) ===|
T:\ImageMagick-6.8.5\include\ImageMagick-6\magick\magick-config.h|29|warning: #warning "you should set MAGICKCORE_QUANTUM_DEPTH to sensible default set it to configure time default" [-Wcpp]|
T:\ImageMagick-6.8.5\include\ImageMagick-6\magick\magick-config.h|30|warning: #warning "this is an obsolete behavior please fix your makefile" [-Wcpp]|
T:\ImageMagick-6.8.5\include\ImageMagick-6\magick\magick-config.h|52|warning: #warning "you should set MAGICKCORE_HDRI_ENABLE to sensible default set it to configure time default" [-Wcpp]|
T:\ImageMagick-6.8.5\include\ImageMagick-6\magick\magick-config.h|53|warning: #warning "this is an obsolete behavior please fix yours makefile" [-Wcpp]|
||=== Build finished: 0 error(s), 4 warning(s) (0 minute(s), 1 second(s)) ===|

My next issue now is that I can't execute the compiled program. First it told me that a libMagick library was missing so I dropped that in the same folder as the compiled binary, but now it's complaining about missing pthreadGC2.dll and I have no idea where that came from.

So, is there a way to create these binaries where they don't rely on the various library files needing to be present in the same folder? I realize this would make the binary itself much larger but in the end I think it would make it easier for distributing.

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: C::B With IM
« Reply #29 on: April 07, 2014, 01:29:30 am »
Could be that they compiled against an older mingw. You might need to compile it yourself. In any case, this is getting off topic for the Code::Blocks forum. You may be better served (and better follow our forum rules) by taking this up on the ImageMagick support forums/lists.

Offline kirash4

  • Multiple posting newcomer
  • *
  • Posts: 42
Re: C::B With IM
« Reply #30 on: April 07, 2014, 01:34:07 am »
You're probably right, and I think the pthread issue has more to do with MinGW than IM. But, staying on C::B, I need to understand how it works if I'm going to make the transition. So what I want to ultimately do, is create an application with the help of wxWidgets and IM. And I need to be able to distribute that to other people who may or may not have supporting pieces (libraries) installed. What does that mean for me? Are there things I need to be setting within C::B to be able to create binary files that are self contained?

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: C::B With IM
« Reply #31 on: April 07, 2014, 02:58:54 am »
That's mostly a choice about using static vs dynamic libs. Most of the libs can be compiled static. But it's also not a huge deal to bundle in a handful of dlls. E.g. code::blocks itself has a handful of self built 3rd party DLLs alongside the main executable.

Offline kirash4

  • Multiple posting newcomer
  • *
  • Posts: 42
Re: C::B With IM
« Reply #32 on: April 07, 2014, 03:00:03 am »
Cool, thanks. I'll look into that. Thanks for all your help with this!