How can I find out which c++ compiler is Xcode 5 using? - xcode

I am currently writing c++ code and compiling using Xcode. I was wondering: How can I find out which c++ compiler is Xcode 5 using?
I would like to know that to make sure that the program I am writing is compilable on other computers that don't necessarily use the same compiler.
Thanks in advance!

You can also check your target's build settings to see what the current setting is. However, Xcode 5 only uses the LLVM 5.0 compiler. GCC is no longer used.
https://developer.apple.com/technologies/tools/features.html

Related

Usign OS X SDK 10.7 with Xcode 7.3 and CMake

I have a serious issue getting Xcode 7.3 to compile a Project against Mac SDK 10.7 with LLVM (7+) and C++11. The source of the issue seems to be Xcode or the fact that I'm running OS X 10.11. Some colleagues of mine don't have the same issue compiling the same issue with older Xcode Versions (6). Here is the general setup:
The needed Libraries and Headers are linked with CMake. The Include paths of everything got checked multiple times. The created Xcode Project also seems to be ok, we've compared all important settings (C++ dialect, std library , target, defines etc) against systems where the project does compile.
The actual error comes when compiling vecLib source.It seems to be a set of random error messages I would trace back to the lack of c++ std headers.. Here are a few examples:
Explicite specialization of non-template class 'complex'
Redifinition of complex as different kind of symbol
Did anybody run into similar problems when working with newer Xcodes against older SDKs?
EDIT
Here is some more informations. After checking what was behind the redifinition, I found that for some odd reason, the complex definition that was interfering with the forward declaration in the file comes from /usr/include/c++/4.2.1. I think that the header is outdated or at least not compatible with c++11. I checked again what the compiler used and the lib / language (std=c++11 and stdlib=libc++) where correctly set. I have the strange feeling that the source in user/include isn't supposed to be included but I don't know how to fix it.
EDIT 2
I've checked the standard include paths with cpp -v and got the following list:
/usr/local/include
/Applications/XCode/.../XCodeDefault.xtoolchain/usr/bin/../lib/clang/7.3.0/include
/Applications/XCode/.../XCodeDefault.xtoolchain/usr/include
/usr/include
/System/Library/Frameworks
/Library/Frameworks
The definition of complex in the Xcode toolchain (3rd entry) is the correct one, the definition in /usr/include is the one that seems to be used while compiling, leading to the error messages. The definition of complex uses structs.
What is the issue here? Is the issue that Xcode / Clang or what ever decides to go with usr/include instead of the toolchain include? I've checked the project settings and the compiler output and there was no explicit include of this path.
It seems like AppleClang 7+ and libc++ just doesn't support vecLib from OS X SDK 10.7. I had to go back to Xcode 6 to get it to build.

building boost with clang 3.8 on windows

From some Googling around it seems that clang's support for windows has been improving recently and boost's support for clang may also have improved. But I'm fairly new to all this heavy-lifting compiler configuration stuff and new to boost, so I'm not sure what the current status really is.
I'm trying to run the command:
b2 --build-dir=build toolset=clang --build-type=complete stage
as suggested in section 5.2.4 in www.boost.org/.../getting_started/windows.
This does work to some extent, but watching the logs being printed to screen I see a few worrying things:
statements starting clang-linux.compile.c++.... even though I am on windows.
12 warnings generated. (or similar) perhaps always these are -Wunused-local-typedef, but I'm not sure.
2 warnings and 8 errors generated (or similar) surely if there are errors the build has failed? How am I supposed to know which component of boost has not built properly and what can I do to fix this?
I'm not clear whether I need MSVC the compiler, Visual Stufio the IDE, and/or MinGW and whether I need to manually set flags to pass to the compiler? Perhaps clang+boost is not ready for windows yet?
Ultimately I want to use boost.python, and at a later date maybe boost.coroutine.
Presumably if I want to use clang for my own projects I need to compile boost with clang too?
bootstrap --with-toolset=clang-win
b2 toolset=clang-win
Make sure that clang.exe is on your PATH.

How do I use gcc 4.5 in XCode 4?

I have install g++-4.5, as I'm interested in the C++0x stuff (done by sudo port install gcc45). Now I've made sure it's my default compiler (using gcc_select) and all of my Makefile projects do just fine compiling with 4.5.
Now I'm starting a project in xCode 4. How do I get the same C++0x features from within xCode, a.k.a. tell xCode to use g++-4.5?
These two bloggers describe hacking together an Xcode plugin to use one's own build of clang. I imagine you could use the same thing but substitute gcc 4.5's path.
http://belkadan.com/blog/2011/07/Using-Clang-from-SVN-in-Xcode/
http://shapeof.com/archives/2010/01/using_the_latest_llvm_with_xcode.html
I've been meaning to try, and found your question in my research.

Xcode 4 and CUDA

Is there any way Xcode 4 can compile or just read correctly CUDA code ?
Thanks
You must look at the following links :
Combining CUDA, Qt, and Xcode
Cude-Gdb guide
Also, a bit related : Can't Build a simple Cuda Program using Xcode !!!
For Xcode 3.2, I used the plugin posted in a thread in Nvidia Forum. I have just upgraded to Xcode 4.0 and cannot build my CUDA project anymore because all .cu files are not compiled. I guess a new build rule in an active target needs to be added.
(I will edit and add more details if I can fix this.)

Precompiled C++ headers with Clang++ 2.0 (Xcode 4 Developer Preview 2)

Does anyone know if precompiled headers are supported when using Clang++ 2.0? I've installed Xcode 4 Developer Preview 2 which includes a Clang++ build that reports its version as "Apple clang version 2.0 (tags/Apple/clang-108.3))", but trying to replicate the basic PCH usage example at http://clang.llvm.org/docs/UsersManual.html#precompiledheaders for a C++ program with some STL headers in the PCH doesn't seem to work, i.e. build times are the same either way (~350ms in my case).
My guess is that PCHs for Clang++ just aren't supported fully at this stage, or for some reason you don't get much benefit from them, but maybe someone else knows more details?
The PCH created by Clang++ is ~2.5MB.
Thanks.
Looking at recent Clang commits reveals that C++ precompiled header support is present as of r110879, committed on 12 August 2010.
I checked out the LLVM and Clang sources and tested it - compile time went down by ~2.5x - nice!
This feature will no doubt make it into the next Xcode 4 prerelease/beta from Apple.

Resources