【问题标题】:Why am I not able to use Vectors in the Dev C/C++ IDE [closed]为什么我无法在 Dev C/C++ IDE 中使用向量 [关闭]
【发布时间】:2016-10-02 17:18:06
【问题描述】:

所以,在这里我只想定义一个向量,然后打印向量当前状态的大小,但是 dev c/c++ 中的编译器给了我一个编译时错误,“向量没有在 scope() 中声明” "

我想知道我是否没有包含正确的头文件或其他东西。

#include<iostream>
using namespace std;
int main()
{   
   vector<int> v(6);               //defining the vector 
   cout<<"Size= "<<v.size();      //printing the present size of the vector
   return 0;
}

【问题讨论】:

  • #include &lt;vector&gt; 是通往Warp drive 的正确道路。
  • “我想知道我是否没有包含正确的头文件”并且您认为在这里花几分钟问一个问题比花几秒钟看docs of std::vector更有效?
  • 我是 C++ 新手,所以我问。这可能看起来很傻,但是,嘿,什么问题不呢?

标签: c++ vector return dev-c++


【解决方案1】:

只需包含矢量标题。

#include &lt;vector&gt;

【讨论】:

    猜你喜欢
    • 2011-10-12
    • 1970-01-01
    • 2015-05-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-03-24
    • 1970-01-01
    • 2018-02-06
    相关资源
    最近更新 更多