Home c++ Error multiple definition of, etc.

Error multiple definition of, etc.

Author

Date

Category

Started learning WxWidgets. You need to create XYZArray via WX_DECLARE_OBJARRAY and WX_DEFINE_OBJARRAY. But something doesn’t work, although I did everything as in the documentation.

# ifndef WXPOINTS_H_INCLUDED
#define WXPOINTS_H_INCLUDED
// # include "xyz.h"
#include & lt; wx / dynarray.h & gt;
class XYZ;
WX_DECLARE_OBJARRAY (XYZ, XYZArray);
class XYZ
{
public:
  float x;
  float y;
  float z;
  // void print ();
};
#include & lt; wx / arrimpl.cpp & gt;
WX_DEFINE_OBJARRAY (XYZArray);
class wxPoints
{
public:
  wxPoints ();
  XYZArray arr;
  void Test ();
};
#endif // WXPOINTS_H_INCLUDED

Throws errors:
Actually, errors


Answer 1, authority 100%

The source in which the XYZArray is defined is included two times. CPP files should not be included via include, and H files should have a check for re-inclusion.

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions