您的位置:首页 > 编程语言 > C语言/C++

(C++) Assertion failed: !"Bad error code", file VMem.c, line 715

2015-05-11 10:31 851 查看

(C++) Assertion failed: !"Bad error code", file VMem.c, line 715

Misc error.

myInterface

Full error message

Assertion failed: !"Bad error code", file VMem.c, line 715
View a screenshot of this error message

Cause

IDE: C++ Builder 6.0

Project type: VCL

Appears when linking the following code:

#define ARRAY_SIZE 10000000

int main()
{
int array[ARRAY_SIZE];
}

Solutions

When this error occurs, restart C++ Builder and nothing has been lost. Do change the code as in one of the examples below.

Decrease the value of the array size

#define ARRAY_SIZE 1000000

int main()
{
int array[ARRAY_SIZE];
}

Create the array dynamically

#define ARRAY_SIZE 10000000

int main()
{
int * const array = new int(ARRAY_SIZE);
}

Use a std::vector (preferred)

#include <vector>

int main()
{
const int sz = 10000000;
std::vector<int> v(sz);
}
Go back to Richel Bilderbeek's C++ page.

Go back to Richel Bilderbeek's homepage.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐