I'm having problems trying to compile this code:
int *array_aleatorio = new int[8]{0, 1, 2, 3, 4, 5, 6, 7};
This is the error that shows up:
main.cpp:315:38: error: expected ';' at end of declaration
int *array_aleatorio = new int[8]{0, 1, 2, 3, 4, 5, 6, 7};
One of my teammates told me this can be because I'm not using the correct compilator. He's using C++11
and it works. I've tried to install it without any success.
I'm using OSX 10.6.8
and Netbeans 7.3
I'm using clang++
.
I've tried this this solution by adding the -std=c++11 -stdlib=libc++ -Weverything
line to the compiling properties of the project, but it's not working:
This is the error that shows up when I try to execute it by adding the lines above.
clang++ -std=c++11 -stdlib=libc++ -Weverything -c -g -std=c++11
-stdlib=libc++ -Weverything -MMD -MP -MF build/Debug/GNU-MacOSX/main.o.d -o build/Debug/GNU-MacOSX/main.o
main.cpp clang: warning: argument unused during compilation:
'-std=c++11' clang: warning: argument unused during compilation:
'-stdlib=libc++' warning: unknown warning option '-Weverything'
[-Wunknown-warning-option] warning: unknown warning option
'-Weverything' [-Wunknown-warning-option] error: invalid value 'c++11'
in '-std=c++11'
Can someone tell me how to install C++11 in OSX? Thanks in advance.