Error C2514: "UNIT": CLASS NOT CONSTRUCTOR

I am getting an error error C2514: 'BLOCK' : CLASS HAS NO CONSTRUCTORwith a simple class like this:

BLOCK.h

#pragma once
#include "helpful.h"

class WORLD;

class BLOCK
{
    public:
        short int type;

        void Render();

        BLOCK();
        ~BLOCK(void);
};

BLOCK.cpp

#include "BLOCK.h"
#include "WORLD.h"

BLOCK::BLOCK(void)
{
}
void BLOCK::Render()
{
}
BLOCK::~BLOCK(void)
{
}

But the class is BLOCKdefined, no?

+3
source share
3 answers

I found my mistake: the constructor call BLOCKwas in a different file, but the header for was BLOCKnot included, all that I had was class BLOCK;. Instead, he changed the meaning #include BLOCK.h, the problem was resolved.

+3
source

You need to find it in MYCLASS

+1
source

MSDN, C2514 , :

, , , .

I assume that you are not passing the correct parameters to the class constructor. The code that raised the error is obviously not part of what you showed.

0
source

Source: https://habr.com/ru/post/1787171/


All Articles