5

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!

Michael Celey
  • 12,395
  • 6
  • 55
  • 61
Nick BL
  • 261
  • 1
  • 11

2 Answers2

1

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 ]

0

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.

Guddu
  • 2,235
  • 2
  • 16
  • 23