Visual Studio Code c++11 extension warning

前端 未结 5 1550
误落风尘
误落风尘 2021-01-11 15:34

I am in the process of learning c++ and I\'m using visual studio code for Mac. I use Code Runner to run my program. My problem is that when I use something from c++11 like \

5条回答
  •  青春惊慌失措
    2021-01-11 16:06

    I spent so long today trying to figure out why I was getting this error and no where had the exact answer I required so I thought I'd post it here just in case I can save anyone the hassle.

    If you're using code runner, look in user settings and set:

     "code-runner.executorMap" : { "cpp" : "cd $dir && g++ -std=c++17 $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt" }
    

    The pertinent bit being "g++ -std=c++17".

    This is providing of course you can compile your programme in shell using Daniel's solution above but not in VScode + and using code runner.

提交回复
热议问题