How to setup Xcode to run C++20? - xcode

How do I run c++ 20 code (eg , concepts) in Xcode.
The C++ language dialect is set to C++20[-std=c++20] and Standard Library is set to libc++(LLVM C++ standard library with C++11 support). I checked the compiler support website https://en.cppreference.com/w/cpp/compiler_support and Apple Clang 12.0.0 has partial support for Concepts. I am running 13.0.0.
Any help would be much appreciated!
Thank you
I set the flags to the best of my knowledge.

Download and install the latest version of Xcode from the App Store.
Once Xcode is installed, open it and go to the “Preferences” tab.
In the “Languages & Regions” tab, select “C++20” from the dropdown menu.
In the “Build Settings” tab, set the “Compiler for C/C++” to “Clang 10.0” or higher.
Finally, in the “Build Phases” tab, add the “-std=c++20” flag to the “Other C Flags” section.
Now you are ready to write and compile C++20 programs in Xcode!

Related

Xcode- Library not found for - IGoogleUtilities

I am new to Apple and Xcode, I make an application in unity3d and I try to implement AdMob. When I Run for test in xCode I have the error: Library not found for- IGoogleUtilities.
https://imgur.com/a/RTDZPYw
Also when I select "Simulator SDK" from Build Settings/Player Settings/Other Settings the build Button is interactable
Maybe it'il help someone;
"When using Unity 5.6 and above, an xcworkspace is generated that includes the required dependency libraries. Use the generated xcworkspace instead of the standard Xcode project."
Select device SDK from Unity editor.
inside Xcode, You should download and add GoogleMobileAds.framework then rebuild.
Let me know if it helps.

How to use framework in Xcode Source Editor Extension?

I'm building an Xcode Editor Extension in Xcode 8.3.2, all go fine until I add framework. I 've used Cocoapods and Carthage, but it warns with warning: linking against dylib not safe for use in application extensions
It can run, but the menu under Editor is disabled. I tried How to suppress `warning: linking against dylib not safe for use in application extensions`? to set Require Only App-Extension-Safe API to No, but the menu is still disabled.
I then tried setting Require Only App-Extension-Safe API to YES for both app target, extension target and the framework that I'm using, still the same problem.
My workaround is to add the source files directly into my extension target. But I would like to use a 3rd framework in my extension

Per file compiler flags in Xcode 8.1

I need to add some specific compiler flags only for certain files in my project. I did some googling and found out that this used to be possible in the file inspector in older Xcode versions. I'm on Xcode 8.1, however, and I can't seem to find where I can add custom compiler flags for certain files.
Could anybody please tell me how this is possible with Xcode 8.1?
Go to the navigation bar of your project
Click on your project
Click on the target you want to modify
Click on Build Phases
Look for the file you want to add the compiler flag in the Compile Sources list; in this list you should see two columns: name and compiler flags
Click on the latter column and a popup window should come up; add the compiler flags to that specific file

SDL and SFML not working with Xcode 5

I got used to VS quiet well, but hopped to Mac. OS X is fantastic, and I'm playing with Xcode now. I do not like it... For Apple related stuff it is great, but God, SFML and SDL are not working! I got same problem with both! I installed Command line Tool, and installed both Frameworks and everything, made templates, but when I build my main.cpp, it get's broken in same place. On the line #import <Foundation/Foundation.h> it says can't find Foundation/Foundation.h, and I tried adding path, and fiddling all the things in build phase, but still nothing. It is so frustrating! I can't wait for JetBrains to release their C++ IDE. Can anybody help me with these? I tried recompiling SDL2, since it was crashing Xcode but then I got that Foundation.h is missing. SFML is showing me the same thing, even if I created template and everything else is perfect. Can anybody help me?
It sounds like you need to add Foundation.framework to your Xcode project. To do that:
Click on your project's icon in the Project Navigator pane. This will show you the various targets in your project. (There's probably only 1 if you've just made the project.)
Click on the target you're trying to build, then click the "Build Phases" tab.
Twirl open the section named "Link Binary With Libraries" and click the "+" button. It will display a dialog with a list of the standard frameworks. There's a search box at the top. You can just type "Foundation" and it will find it.
Select it, and click "Add". That should add it to your target.

xcode 4.5.1 not loading .gdbinit

I have a .gdbinit file. I have been using it for years. It is in my home directory. I still need to do Xcode debugging under gdb, not lldb. But Xcode 4.5.1 does not load the file when it runs an app.
I can load it manually with 'source ~/.gdbinit'. But that's a pain! Any way to configure it to load on launch?
How about adding source ~/.gdbinit to the Pre-actions part of the "Run" scheme in your project (Cmd + < to access the scheme editor)?
I read somewhere and have experienced that Xcode 4.5 and 4.5.1 have many bugs in them and this could be one of them. I cannot really help with this but to say:
1.) remove xcode.app from finder in applications
2.) download Xcode 4.4.1 from the apple website: https://developer.apple.com/downloads/index.action?name=Xcode%204.4.1
3.) put it into the applications folder.
4.) Run Xcode 4.4.1 and run your app!
I have had to do this twice due to these two versions of xcode being buggy.

Resources