【问题标题】:"Hello world" exercise in c++ throws ArrayIndexOutOfBoundsExceptionC++ 中的“Hello world”练习抛出 ArrayIndexOutOfBoundsException
【发布时间】:2021-04-30 03:04:08
【问题描述】:

我的教科书显示了要运行的这段 C++ 代码,但是当我在 net beans 上运行它时,它显示此错误 Exception in thread "main" ArrayIndexOutOfBoundsException: 0

#include <iostream>

using namespace std;

int main(void)
{ 
  cout << "Hello world";
  return 0; 
}

【问题讨论】:

  • 阅读 this C++ reference,你的 C++ 编译器的文档,也许 GCC 被调用为 g++ -Wall -Wextra -g。然后阅读调试器的文档,也许是GDB。您可能有兴趣在您的计算机上安装DebianGNU emacs
  • 从现有的 C++ 开源代码中汲取灵感,例如 FLTKRefPerSysfishQt

标签: c++ arrays arrayindexoutofboundsexception


【解决方案1】:

c++中没有java.lang.ArrayIndexOutOfBoundsException

该错误是因为 netbeans 正在运行另一个 java 项目。

右键单击 c++ 项目并单击“关闭其他...” 然后你就可以做正确的了。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-03-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多