Using the GNU libstdc++ in AppCode

Hi,

Waiting for the C++ IDE, I am using AppCode for the time being. I would like to have bound checking with vectors in C++ when I debug the application. For that, I would like

v[n] = 1.0;

to raise an exception when n is out of range (I don't want to change it to .at(n)). The GNU standard C++ library provides that when we use -

D_GLIBCXX_DEBUG.


So, my question would be :
- How do we tell AppCode to use the stdlibc++ library ?
- How do we pass the option -D_GLIBCXX_DEBUG ?

Best regards,
François
4 comments
Comment actions Permalink

Francois, please try to set in Project Settings:
CLANG_CXX_LIBRARY: libstdc++
GCC_PREPROCESSOR_DEFINITIONS for DEBUG: DEBUG=1 _GLIBBCXX_DEBUG

0
Comment actions Permalink

Thank you very much. It works like a charm (with DEBUG=1 _GLIBCXX_DEBUG).

Also, is there a way to use another version of clang (I have clang++-3.4 compiled with address sanitizer) or gcc-4.9 which are under /usr/local on my machine ?

Best regards,
François

0
Comment actions Permalink

Francois,

AppCode supports only bundled Xcode compilers.
Apple removed support of GCC since Xcode 5, so firstly you have to install it to Xcode (can be done with home-brew) and set up in project settings.
For detailed information please follow the instructions: http://stackoverflow.com/questions/19061966/how-to-use-a-recent-gcc-with-xcode-5

0
Comment actions Permalink

Hi Artur,

I'll wait for the C++ IDE for that. Thanks for your help.

0

Please sign in to leave a comment.