Error multiple definition of and other

I started learning wxWidgets. You need to create an XYZArray using WX_DECLARE_OBJARRAY and WX_DEFINE_OBJARRAY. But something does not work out, although I did everything as in the documentation.

#ifndef WXPOINTS_H_INCLUDED
#define WXPOINTS_H_INCLUDED

//#include "xyz.h"
#include <wx/dynarray.h>

class XYZ;
WX_DECLARE_OBJARRAY(XYZ, XYZArray);

class XYZ
{
public:
    float x;
    float y;
    float z;
    //void print();
};
#include <wx/arrimpl.cpp>
WX_DEFINE_OBJARRAY(XYZArray);

class wxPoints
{
public:
    wxPoints();
    XYZArray arr;
    void Test();
};


#endif // WXPOINTS_H_INCLUDED

Throws errors: Actually, errors

Author: ArcSin, 2016-09-21

1 answers

The source code that defines XYZArray is connected twice. You should not connect CPP files via include, and the H-files should be checked for re-inclusion.

 2
Author: Ильдар Хайруллин, 2016-09-21 19:29:12