Re: bug compiling in gnu g++ in c++0x std

Bob Friesenhahn <[email protected]> Thu, 10 May 2012 11:36:00 -0500 (CDT)
Newsgroups gmane.comp.video.graphicsmagick.bugs
Message-ID <[email protected]>
On Thu, 10 May 2012, Leandro Santiago wrote:

> Hello to all. I'm new in graphicsmagick.
>
> I'm going to use Magick++ in a server site application written in
> C++2011 and I found a problem when I try to link GraphicsMagick in my
> app. But the problem also happens with small programs (i created a
> simple main.cpp which just creates an image from disk) like the
> demo.cpp in Magick++/demo dir.
>
> Trying to compile without C++0x:
>
> $ g++ -o demo demo.cpp `GraphicsMagick++-config --cppflags --cxxflags
> --ldflags --libs`
>
> Everything OK.
>
> But with C++0x enabled (-std=c++0x);

GraphicsMagick itself is not using the symbols which show up as 
unresolved.  The problem is with what an option like -std=c++0x does. 
In addition to adding/adjusting language features, it also takes away 
all definitions and symbols which are not part of that specification. 
It is changing both the API and the ABI.

In order to succeed, you will need to find a more relaxed compiler 
option which supports C++2011 features while not disabling interfaces 
not included in C++2011 (most operating system interfaces are not 
included in C++2011!).  It is not always possible to compile normal 
software in strict/pedantic ANSI modes because they are so 
restrictive.

In order to assure that everything is good, GraphicsMagick and any 
other libraries used should be built with similar options.

On Linux, the configure script builds GraphicsMagick with the option 
'-std=gnu99'.  Perhaps building the C code with '-std=gnu11' and the 
C++ code with '-std=gnu++11' will help.  Even in GCC 4.7 this support 
is experimental.

Bob
-- 
Bob Friesenhahn
[email protected], http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/