简体   繁体   中英

C++: error: summary string parsing error

I'm having a problem creating a new instance of a class I defined. I created a class called PointArray with the corresponding constructor as follows:

class PointArray {
private:
    int size;
    Point *points;

public:
PointArray(const Point pts[], const int siz) {
    size = siz;
    points = new Point[siz];
    for (int i = 0; i < siz; i++) {
        points[i] = pts[i];
    }
} 

However, when I try to create a new instance I get an "error: summary string parsing error". I try to create the instance as follows:

Point p(4,3);
Point q(-1,5);
Point r(2,-4);
Point arr[3] = {p,q,r};
PointArray pb(arr, 3);

where Point is a previously defined class which works fine. Any ideas what I am doing wrong here?

This message is from LLDB, and means that your variable has been optimised out.

You can rebuild with -O0 which should prevent the compiler from optimising, however, your code will run very slowly.

Note that GCC has a compiler flag -Og, which optimises as much as it can without affecting debugging performance.

Clang also has this flag, but it's currently mapped to -O1 which means that some information will be lost.

This seems to happen when the variable name is not entirely unique and the debugger has a different definition of it somewhere in its dictionary. Try to change the name of PointArray to, say, myPointArray, and the problem may go away.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM