Nick BL
Nick BL

Reputation: 373

Clang++ not understanding c++11 in mac terminal

I am trying to get some c++ code (with c++11) to compile in the mac terminal. I tried

clang++ -std=c++11 main.cpp

but i get the error

error: invalid value 'c++11' in '-std=c++11'

My xcode is completely up to date, I am assuming I am doing something wrong in the terminal? The code runs fine in xcode itself, I just cannot get it to run in the terminal. Any tips would be great!

Upvotes: 5

Views: 2601

Answers (2)

Guddu
Guddu

Reputation: 2437

i am not sure about this but in my experience, being up-to-date in Xcode might not mean that you are up-to-date in clang too, i had problem while trying to compile a c++ code using g++ on mac osx mountain lion. my xcode was latest but gcc was old (4.2.1). i had to install latest version of gcc from http://hpc.sourceforge.net (4.8.1). now it works. i use g++ -std=c++11 for compiling.

Upvotes: 0

user283145
user283145

Reputation:

As Andy has already said, your compiler only accepts -std=c++0x. It`s probably quite old.

[ Answering only to remove the question from unanswered question queue ]

Upvotes: 1

Related Questions