[gecode-users] Mac XCode configuration

Guido Tack tack at gecode.org
Mon Apr 7 12:18:49 CEST 2014


On 7 Apr 2014, at 5:40 pm, Tomas Lidén <tomas.liden at liu.se> wrote:

> Thanks for quick and adequate response!
> But still there's trouble... see below
> /T
> 
> Guido Tack wrote 2014-04-07 02:03:
>> Hi,
>> 
>> to add a system folder such as /usr/local, open the "Add Files to..." dialog, press Command+Shift+G, and enter the path directly.
>> 
> Great. That got me halfway.
> After adding the frameworks QtGui, QtWidgets and QtCore and adjusting the include statements to
> #include <QtGui/QtGui>
> #include <QtWidgets/QtWidgets>
> the compilation ends with the following error:
> /usr/local/qt5.1.0/lib/QtCore.framework/Headers/qlist.h:52:10: 'initializer_list' file not found
> 
> According to (http://comments.gmane.org/gmane.comp.lib.qt.user/8357) and (the subsequent links) this is due to Qt requiring -stdlib=libc+ (not libc++ ?) and c++11 - which is in conflict with libstdc++ that is required by Gecode. Hmm.. I can't figure out to get passed this - tried varies ways in Xcode, but no luck so far. Should I perhaps download and install Qt directly from the source rather than using the version coming with Gecode?

I will probably build new packages soon based on libc++ and linked to the newest version of Qt, but until then you basically have two alternatives: compile Gecode from sources with libc++, or compile Qt from sources with libstdc++.

>> On the command line, I think Xcode may have changed the default paths for frameworks, you could try adding -F/Library/Frameworks to your compiler options.
>> 
> That almost did the trick. Again I had to add options for selecting libstdc++ etc, but still I get an error. After trying the (what I think) options that Xcode uses I get:
> 
> $ g++ -std=gnu++11 -stdlib=libstdc++ -O3 -F/Library/Frameworks -c money.cpp
> money.cpp:1:1: error: expected unqualified-id
> <U+001C>/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
> ^

Have a look at the money.cpp file, looks like there's a funny character on the first line.

Cheers,
Guido

> In file included from money.cpp:38:
> In file included from /Library/Frameworks/gecode.framework/Headers/driver.hh:41:
> In file included from /Library/Frameworks/gecode.framework/Headers/minimodel.hh:47:
> In file included from /Library/Frameworks/gecode.framework/Headers/kernel.hh:127:
> /Library/Frameworks/gecode.framework/Headers/kernel/core.hpp:3800:7: warning: 
>       array index 1 is past the end of the array (which contains 1 element)
>       [-Warray-bounds]
>       x->u.idx[1] = u.idx[1];
>       ^        ~
> /Library/Frameworks/gecode.framework/Headers/kernel/core.hpp:3829:49: note: in
>       instantiation of member function
>       'Gecode::VarImp<Gecode::Int::BoolVarImpConf>::update' requested here
>       VarImp<VIC>* n = x->next(); x->forward()->update(x,sub); x = n;
>                                                 ^
> /Library/Frameworks/gecode.framework/Headers/kernel/var-imp.hpp:407:50: note: 
>       in instantiation of member function
>       'Gecode::VarImp<Gecode::Int::BoolVarImpConf>::update' requested here
>     Gecode::VarImp<Gecode::Int::BoolVarImpConf>::update(*this,sub);
>                                                  ^
> /Library/Frameworks/gecode.framework/Headers/kernel/core.hpp:339:7: note: array
>       'idx' declared here
>       unsigned int idx[pc_max+1];
>       ^
> /Library/Frameworks/gecode.framework/Headers/kernel/core.hpp:3800:21: warning: 
>       array index 1 is past the end of the array (which contains 1 element)
>       [-Warray-bounds]
>       x->u.idx[1] = u.idx[1];
>                     ^     ~
> /Library/Frameworks/gecode.framework/Headers/kernel/core.hpp:339:7: note: array
>       'idx' declared here
>       unsigned int idx[pc_max+1];
>       ^
> 2 warnings and 1 error generated.
> 
> clang gives the same result..
>> Cheers
>> Guido
>> 
>> On 7 Apr 2014, at 6:26 am, Tomas Lidén 
>> <tomas.liden at liu.se>
>>  wrote:
>> 
>> 
>>> Hi!
>>> 
>>> I'm running MacOS 10.9.2, Xcode 5.1 (5B130a) and Gecode 4.2.1 - all freshly updated/installed.
>>> But being a newbie (both to Xcode and Gecode) and a bit rusty on C++, I have some trouble getting the configurations right..
>>> 
>>> Firstly a great thanks for Guido's help regarding libstdc++ (
>>> http://www.gecode.org/pipermail/users/2014-April/004368.html
>>> ) - which got me past the first blocking point.
>>> 
>>> But now I can't get Qt to work (e.g. examples/queens.cpp). I can see that qt5.1.0 is installed in /usr/local/ but I can't figure out how to add the necessary frameworks (probably the ones in /usr/local/qt5.1.0/lib/.) to the project. For gecode.framework I use File/Add Files to.. and click to /Library/Frameworks - but /usr/local is inaccessible from the Finder interface.. Is there some other mechanism or do I need to add some soft links or similar? (The Add/Existing Frameworks.. mentioned in MGP 2.3.2 I have not found..)
>>> 
>>> BTW, the command line option does not work either as stated in the documentation (MGP 2.3.2), neither with g++ or clang - see the log below. The "default header search path" does not seem to be sufficient.. I guess there's some include or library options that's needed - any help on that as well? (I think this is the reason I have no success in using Eclipse/CDT either..).
>>> 
>>> Thanks for any help or tip you can provide, primarily regarding accessing Qt in Xcode!
>>> /Tomas
>>> 
> 
> _______________________________________________
> Gecode users mailing list
> users at gecode.org
> https://www.gecode.org/mailman/listinfo/gecode-users




More information about the users mailing list