小编zma*_*ine的帖子

0xC0000005:访问冲突读取位置0xccccccd0.C++

当我尝试将字符串(存储在类中)设置为等于另一个字符串时,我遇到了上述问题.我已经梳理和梳理试图找到我是否没有初始化任何变量,但我找不到这样的情况.在debug mod中,我得到了上述错误.在发布模式下,它会挂起,Win7会查找问题,没有重大中止或重试窗口.这是相关的代码,如果你认为应该包含我的主程序,还有另一个头文件,我将包括导致错误的行.语言显然是C++.

//Error occurs in this area:
   Car one;
   one = two;
   one.addExtra ("Windows");

   log << "Car one: " << one << endl;
   two = Car(one); // call copy constructor.
//I realize when I call the first one = two, there are no extras
//stored int Car one, which is what differs between the two. Remaining 
//code. Extras header:

#include <iostream>
#include <string>
#include <string.h>
using namespace std;

class Extras
{
public:
    friend class Car;
    friend int main();
    friend ostream& …
Run Code Online (Sandbox Code Playgroud)

c++ access-violation

1
推荐指数
2
解决办法
8149
查看次数

标签 统计

access-violation ×1

c++ ×1