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 &lt;iostream&gt;

int main(int argc, const char * argv[]) {
    int arr[] = {1,2,3,4,5};
    for(int&amp; e : arr) {
        std::cout &lt;&lt; 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&amp; 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.


EDIT 3: I found another switch to make warnings errors
Click on a Project file, then Build Settings and find C++ Language Dialect.



Use this to get an error: