Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error C2514: 'BLOCK' : CLASS HAS NO CONSTRUCTOR

Tags:

c++

I get the error error C2514: 'BLOCK' : CLASS HAS NO CONSTRUCTOR with 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 BLOCK class is defined, no?

like image 674
Entretoize Avatar asked Feb 22 '26 12:02

Entretoize


2 Answers

I found my mistake: The call to BLOCK's constructor was in another file, but the header for BLOCK wasn't included, all I had was class BLOCK;. Changed it instead to #include BLOCK.h, problem solved.

like image 54
Entretoize Avatar answered Feb 24 '26 05:02

Entretoize


You need to look for it in MYCLASS

like image 30
user32344 Avatar answered Feb 24 '26 04:02

user32344



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!