Eclipse Method could not be resolved in a simple program C++

后端 未结 4 1628
别跟我提以往
别跟我提以往 2020-12-19 06:43

I have an issue with Eclipse Indigo complaining that methods of a class couldn\'t be resolved, but compiling anyway and working correctly (AFAIK). It\'s a very simple progr

4条回答
  •  太阳男子
    2020-12-19 07:32

    sizeof(pointer) returns the size of the pointer (4 on 32-bit systems and 8 on 64-bit), not the size of what it points to! Save the dimensions in the class, and add a function to return them.

    Also, in initializePop shouldn't you allocate the actual X array?

    X = calloc(N, sizeof(char *));
    

    Or rather, you should use new for allocation since you are using C++:

    X = new char* [N];
    

    and later:

    X[i] = new char [numbits];
    

提交回复
热议问题