<legend id='wpn8e'><style id='wpn8e'><dir id='wpn8e'><q id='wpn8e'></q></dir></style></legend>
    • <bdo id='wpn8e'></bdo><ul id='wpn8e'></ul>
  • <small id='wpn8e'></small><noframes id='wpn8e'>

    1. <tfoot id='wpn8e'></tfoot>

        <i id='wpn8e'><tr id='wpn8e'><dt id='wpn8e'><q id='wpn8e'><span id='wpn8e'><b id='wpn8e'><form id='wpn8e'><ins id='wpn8e'></ins><ul id='wpn8e'></ul><sub id='wpn8e'></sub></form><legend id='wpn8e'></legend><bdo id='wpn8e'><pre id='wpn8e'><center id='wpn8e'></center></pre></bdo></b><th id='wpn8e'></th></span></q></dt></tr></i><div id='wpn8e'><tfoot id='wpn8e'></tfoot><dl id='wpn8e'><fieldset id='wpn8e'></fieldset></dl></div>

        Visual Studio Code c++11 扩展警告

        时间:2023-08-03

          • <legend id='26exw'><style id='26exw'><dir id='26exw'><q id='26exw'></q></dir></style></legend>
            <i id='26exw'><tr id='26exw'><dt id='26exw'><q id='26exw'><span id='26exw'><b id='26exw'><form id='26exw'><ins id='26exw'></ins><ul id='26exw'></ul><sub id='26exw'></sub></form><legend id='26exw'></legend><bdo id='26exw'><pre id='26exw'><center id='26exw'></center></pre></bdo></b><th id='26exw'></th></span></q></dt></tr></i><div id='26exw'><tfoot id='26exw'></tfoot><dl id='26exw'><fieldset id='26exw'></fieldset></dl></div>
              <tfoot id='26exw'></tfoot>
                <bdo id='26exw'></bdo><ul id='26exw'></ul>

                    <tbody id='26exw'></tbody>

                  <small id='26exw'></small><noframes id='26exw'>

                1. 本文介绍了Visual Studio Code c++11 扩展警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在学习 C++,我正在使用适用于 Mac 的 Visual Studio 代码.我使用 Code Runner 运行我的程序.我的问题是,当我使用 C++11 中的auto"等变量声明时,visual studio 代码会给我这样的警告,但如果我尝试在 Xcode 或 Eclipse 上运行它,则不会:

                  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 "auto" for variable declaration, visual studio code gives me a warning like this, but if I try running it on Xcode or Eclipse it doesn't:

                  warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions]
                  for(auto y: nstrVec)
                  

                  这是必要的程序:

                  #include <iostream>
                  #include <cstdlib>
                  #include <string>
                  #include <vector>
                  #include <numeric>
                  #include <sstream>
                  
                  int main(){
                  
                  std::vector<std::string> nstrVec(10);
                  
                  std::string str("I'm a string");
                  nstrVec[0] = str;
                  
                  std::cout << str.at(0) << "
                  ";
                  std::cout << str.front() << " " << str.back() << "
                  ";
                  std::cout << "Length " << str.length() << "
                  ";
                  // copies all characters after the fourth 
                  std::string str2(str, 4);
                  
                  for(auto y: nstrVec)
                      if(y != "")
                          std::cout << y << "
                  ";
                  
                  return 0;
                  }
                  

                  这是 c_cpp_proprerties.json 文件:

                  And this is the c_cpp_proprerties.json file:

                  {
                  "configurations": [
                      {
                          "name": "Mac",
                          "includePath": [
                              "${workspaceFolder}/**",
                                   "/System/Library/Frameworks/Kernel.framework/Versions/A/Headers"
                          ],
                          "defines": [],
                          "macFrameworkPath": [
                              "/System/Library/Frameworks",
                              "/Library/Frameworks"
                          ],
                          "compilerPath": "/usr/bin/clang",
                          "cStandard": "c11",
                          "cppStandard": "c++17",
                          "intelliSenseMode": "clang-x64"
                      }
                  ],
                  "version": 4
                  }
                  

                  推荐答案

                  在 VS Code 中:

                  In VS Code:

                  文件>>首选项>>设置>>扩展

                  File>>Preference>>Settings>>Extensions

                  find C_Cpp>默认:Cpp 标准下拉菜单

                  find C_Cpp>Default:Cpp Standard drop down menu

                  将其设置为 c++11

                  set that to c++11

                  这篇关于Visual Studio Code c++11 扩展警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:Visual Studio Code:从用户获取输入 下一篇:Visual Studio Code:如何配置 includePath 以获得更好的

                  相关文章

                  最新文章

                  1. <i id='c1SwS'><tr id='c1SwS'><dt id='c1SwS'><q id='c1SwS'><span id='c1SwS'><b id='c1SwS'><form id='c1SwS'><ins id='c1SwS'></ins><ul id='c1SwS'></ul><sub id='c1SwS'></sub></form><legend id='c1SwS'></legend><bdo id='c1SwS'><pre id='c1SwS'><center id='c1SwS'></center></pre></bdo></b><th id='c1SwS'></th></span></q></dt></tr></i><div id='c1SwS'><tfoot id='c1SwS'></tfoot><dl id='c1SwS'><fieldset id='c1SwS'></fieldset></dl></div>
                    <tfoot id='c1SwS'></tfoot>

                      <small id='c1SwS'></small><noframes id='c1SwS'>

                      <legend id='c1SwS'><style id='c1SwS'><dir id='c1SwS'><q id='c1SwS'></q></dir></style></legend>
                        <bdo id='c1SwS'></bdo><ul id='c1SwS'></ul>