How can I specify the C++ version to use with Xcode?

On the command line I can use clang -std=c++98 -pedantic-errors which will prevent me from using features of newer C++ versions.

How can I achieve the same thing with Xcode?

EDIT: Example code

#include <iostream>

int main(int argc, const char * argv[]) {
    int arr[] = {1,2,3,4,5};
    for(int& e : arr) {
        std::cout << e * e;
    }
    return 0;
}

This is my desired behavior.

$ clang -std=gnu++98 main.cpp -pedantic-errors
main.cpp:5:16: error: range-based for loop is a C++11 extension [-Werror,-Wc++11-extensions]
    for(int& e : arr) {
               ^
1 error generated.

But running Xcode with the c++98 toolchain set doesn't error.

EDIT 2: I found a switch to make it warn, but it Xcode doesn't error. xcode disable c++11 extensions

EDIT 3: I found another switch to make warnings errors warnings to errors


Solution 1:

Click on a Project file, then Build Settings and find C++ Language Dialect.

C++ Language Dialect in Xcode

Use this to get an error:

enter image description here