I'm getting a weird C2535 Error when I run my code.
It consists of a three main classes (summarized below). There are some circular dependencies between them but they are preceded by #pragma once
macros and should not be created more than one time.
The error is occuring on the line:
CVertex(POINT3D p) : nx(0), ny(0), nz(0), nw(0) {
CVertex(p.x, p.y, 0, 1);
where it says:
error C2535: CVertex::CVertex(void) : member function already defined or declared
This doesn't make sense. It should only be getting declared once since I'm using #pragma once
guards! I've tried with ifndef
guards too and it makes no difference.
Here is a summary of the code (the important parts)
//structs.h
#pragma once
#include matrices.h
typedef struct {
LONG x;
LONG y;
LONG z;
} POINT3D;
typedef struct{
....
Matrix4x4 matrixFour;
...
} DeviceStructure;
This is my second file:
//matrices.h
#pragma once
#include structs.h
class CVertex {
public:
CVertex(POINT3D x, POINT3D y, POINT3D z) ..... ;
CVertex(POINT3D p) : nx(0), ny(0), nz(0), nw(0) {
CVertex(p.x, p.y, 0, 1);
}
....
}
My third file:
//world.h
#pragma once
#include structs.h
#include matrices.h
.....
(uses stuff from the previous classes)
....