Despite having clang 15.0.0, vscode on mac os 14.1.1 my code isnt compiling according to newer c++ versions

226 Views Asked by At
(base) sushi@sushi C++ % cd "/Users/sushi/C++/" && g++ hello.cpp -o hello && "/Users/sushi/C++/"hello
hello.cpp:22:26: error: delegating constructors are permitted only in C++11
    Deep(const Deep &j): Deep(*j.data) {
                         ^~~~
1 error generated.

This is the error i'm getting while compiling my c++ code . I've checked my clang and g++ version by going on the terminal and it displays this as the answer

(base) sushi@sushi ~ % clang --version
Apple clang version 15.0.0 (clang-1500.0.40.1)
Target: arm64-apple-darwin23.1.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
(base) sushi@sushi ~ % g++ --version
Apple clang version 15.0.0 (clang-1500.0.40.1)
Target: arm64-apple-darwin23.1.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

How can i fix this error . Not being able to use the newer features in c++ language is really messing my head up

In my tasks.json file i've specified c++17 as the argument so as the compiler compiles the code according to c++ 17 standards , where am i going wrong and how to correct it

0

There are 0 best solutions below