0

I downloaded Magick++ MinGW version. I extracted it to MinGW folder. I moved the files from includes/ImageMagick-6 to includes, because it was complaning when I tried:
#include <ImageMagick-6/Magick++.h>
So now I can write just:
#include <Magick++.h>
main.cpp is:

Image image("100x100","black");
image.write("C:/blackness.png");

Now it writes the following error:

cd 'C:\cprojects\dotmap'
C:\MinGW\msys\1.0\bin\make.exe -f Makefile CONF=Debug
"/C/MinGW/msys/1.0/bin/make.exe" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make.exe[1]: Entering directory `/c/cprojects/dotmap'
"/C/MinGW/msys/1.0/bin/make.exe"  -f nbproject/Makefile-Debug.mk dist/Debug/MinGW-Windows/dotmap.exe
make.exe[2]: Entering directory `/c/cprojects/dotmap'
mkdir -p dist/Debug/MinGW-Windows
g++ -static-libgcc -static-libstdc++    -o dist/Debug/MinGW-Windows/dotmap build/Debug/MinGW-Windows/Cell.o build/Debug/MinGW-Windows/LasHandler.o build/Debug/MinGW-Windows/Point.o build/Debug/MinGW-Windows/main.o 
build/Debug/MinGW-Windows/main.o: In function `main':
C:\cprojects\dotmap/main.cpp:65: undefined reference to `Magick::Color::Color(char const*)'
C:\cprojects\dotmap/main.cpp:65: undefined reference to `Magick::Geometry::Geometry(std::string const&)'
C:\cprojects\dotmap/main.cpp:65: undefined reference to `Magick::Image::Image(Magick::Geometry const&, Magick::Color const&)'
C:\cprojects\dotmap/main.cpp:65: undefined reference to `Magick::Geometry::~Geometry()'
C:\cprojects\dotmap/main.cpp:65: undefined reference to `Magick::Color::~Color()'
C:\cprojects\dotmap/main.cpp:69: undefined reference to `Magick::Image::write(std::string const&)'
C:\cprojects\dotmap/main.cpp:65: undefined reference to `Magick::Image::~Image()'
C:\cprojects\dotmap/main.cpp:49: undefined reference to `Magick::Geometry::~Geometry()'
C:\cprojects\dotmap/main.cpp:49: undefined reference to `Magick::Color::~Color()'
C:\cprojects\dotmap/main.cpp:65: undefined reference to `Magick::Image::~Image()'
collect2.exe: error: ld returned 1 exit status
make.exe[2]: *** [dist/Debug/MinGW-Windows/dotmap.exe] Error 1
make.exe[2]: Leaving directory `/c/cprojects/dotmap'
make.exe[1]: *** [.build-conf] Error 2
make.exe[1]: Leaving directory `/c/cprojects/dotmap'
make.exe": *** [.build-impl] Error 2

BUILD FAILED (exit value 2, total time: 17s)

What google dropped on magick++ undefined reference wasn't helpful. What do I need to do to fix this?


UPDATE
I've added to the linker: -lMagick++-6.Q16.dll -lMagickCore-6.Q16.dll -lMagickWand-6.Q16.dll Now undefined reference is solved, build successful. But on run it says: error while loading shared libraries: ?: cannot open shared object file: No such file or directory

adtewa
  • 189
  • 10
  • 2
    Include only tells the compiler to use a particular header file inside another file. Not all header files have a backing library, so In this line here: `g++ -static-libgcc -static-libstdc++ -o dist/Debug/MinGW-Windows/dotmap build/Debug/MinGW-Windows/Cell.o build/Debug/MinGW-Windows/LasHandler.o build/Debug/MinGW-Windows/Point.o build/Debug/MinGW-Windows/main.o ` you need to tell the linker where to find the Magick++ library with `-L` and which of potentially many libraries in Magick++ to use with `-l` leave out the lib prefix and the .a suffix. – user4581301 Mar 29 '16 at 18:39
  • @user4581301 I told the compiler: `-LC:\MinGW\bin\libMagick++-6.Q16-1.dll -lMagick++ -LC:\MinGW\bin\libMagickCore-6.Q16-1.dll -lMagickCore`, but it told me: `c:/mingw/bin/../lib/gcc/mingw32/4.9.3/../../../../mingw32/bin/ld.exe: cannot find -lMagick++ c:/mingw/bin/../lib/gcc/mingw32/4.9.3/../../../../mingw32/bin/ld.exe: cannot find -lMagickCore` It is getting the -L stuff but not the -l – adtewa Mar 29 '16 at 19:09
  • @user4581301 tried `-LC:\MinGW\lib\libMagick++-6.Q16.dll.a -lMagick++-6.Q16 -LC:\MinGW\lib\libMagickCore-6.Q16.dll.a -lMagickCore-6.Q16` it doesn't say cannot find, but getting the undefined reference messages again – adtewa Mar 29 '16 at 19:30
  • Not being able to find the -L doesn't give any sort of useful error message. `-lMagick++ -lMagickCore` sounds about right, but I don't know where your libraries are installed or even if they were built, but this `C:\MinGW\bin\libMagick++-6.Q16-1.dll` does not seen right to me. – user4581301 Mar 29 '16 at 21:22

0 Answers0