Mac-Mini 2018 OSX 10.14.5 Mojave GPS 19.1 (20190106) hosted on x86_64-apple-darwin16.7.0 GNAT Community 2019 (20190517-83) GPRBUILD Community 2019 (20190517) (x86_64-apple-darwin17.7.0) ImageMagick-7.0.8-35
The C++ code below fails to link on my Mac-Mini under OSX Mojave. A "possible duplicate" is too general to answer my specific problem.
I'm developing some OGL examples with Ada tha use Imagemagick functions. I use Magick::Image::read and related imagemagick routines in C++ interface code for a number of Ada projects. All of my projects build without error on my MacBook Air under OSX High Sierra.
#include <Magick++.h>
#include <iostream>
#include <string>
using namespace std;
using namespace Magick;
int main(int argc, char **argv)
{
string Logo_File = "../images/logo.jpg";
Image logo_image;
Magick::InitializeMagick(*argv);
logo_image.read(Logo_File);
return 0;
}
This code works with GNAT CE 2019 on my MacBook Air under High Sierra. It also works using XCode on my Mac-Mini. Failure occurs for both brew imagemagick and locally built imagemegick.
Failure message: Undefined symbols for architecture x86_64: "Magick::Image::read(std::__cxx11::basic_string, std::allocator > const&)", referenced from: _main in display_logo.o ld: symbol(s) not found for architecture x86_64 collect2: error: ld returned 1 exit status gprbuild: link of display_logo.cpp failed gprbuild: failed command was: /opt/gnat/2019/bin/g++ display_logo.o libshow_logo.a -L/opt/lib -lMagickCore-7.Q16HDRI -lMagick++-7.Q16HDRI -g -Wl,-rpath,/opt/lib -o /Ada_Source/OglAda_Examples/imagemagick/logo//display_logo
The gprbuild command generated by GPS 19.1 is: gprbuild -d -eL -P/Ada_Source/OglAda_Examples/imagemagick/logo/show_logo.gpr -s --config=/Ada_Source/default.cgpr -p
Any assistance will be greatly appreciated. Thanks, Roger
Problem solved. The failure seems to have been caused by the C++ compiler (G++) supplied with GNAT 2019. Changing to the llvm compiler (/usr/bin/clang++) solved the problem.