In Tut20 pt2 when I create the brick array. I get asked to create a default constructor for the Brick class but when I do it says error C2280: 'Brick::Brick(void)': attempting to reference a deleted function also Brick::Brick(void)': function was implicitly deleted because a data member 'Brick::rect' has either no appropriate default constructor or overload resolution was ambiguous (compiling source file Game.cpp)
Any ideas?
[Snek Game] Constructor cannot be referenced
-
- Posts: 6
- Joined: July 21st, 2017, 5:06 pm
-
- Posts: 4373
- Joined: February 28th, 2013, 3:23 am
- Location: Oklahoma, United States
Re: [Snek Game] Constructor cannot be referenced
You didn't post your code, so I'm going to assume this is your issue.
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com
-
- Posts: 6
- Joined: July 21st, 2017, 5:06 pm
Re: [Snek Game] Constructor cannot be referenced
Not exactly.
Here's the code now if you go in game.cpp to the Game constructor you'll find the error saying "Error1790: The default constructor of "Brick" cannot be referenced -- it is a deleted function"
I'm not sure how to fix this error I thought about removing the Brick constructor completely and using a factory function to init the bricks but I get asked to create a default constructor.
I even made an entire BrickWall class that includes the Brick class to take care of the initialising and such but still the same error when I create the BrickWall object in the Game class.
Hope I didn't confuse you because I'm confused myself
PS. I'm using Visual Studio 2017
Here's the code now if you go in game.cpp to the Game constructor you'll find the error saying "Error1790: The default constructor of "Brick" cannot be referenced -- it is a deleted function"
I'm not sure how to fix this error I thought about removing the Brick constructor completely and using a factory function to init the bricks but I get asked to create a default constructor.
I even made an entire BrickWall class that includes the Brick class to take care of the initialising and such but still the same error when I create the BrickWall object in the Game class.
Hope I didn't confuse you because I'm confused myself
PS. I'm using Visual Studio 2017
- Attachments
-
- Fart-Annoyed.zip
- Code
- (2.37 MiB) Downloaded 123 times
-
- Posts: 6
- Joined: July 21st, 2017, 5:06 pm
Re: [Snek Game] Constructor cannot be referenced
And I just realised I put Snek Game in the title my bad was talking about Fart-Annoyed
-
- Posts: 4373
- Joined: February 28th, 2013, 3:23 am
- Location: Oklahoma, United States
Re: [Snek Game] Constructor cannot be referenced
Add this to ShapeRect and you're golden
ShapeRect() = default;
ShapeRect() = default;
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com
-
- Posts: 6
- Joined: July 21st, 2017, 5:06 pm
Re: [Snek Game] Constructor cannot be referenced
I am so grateful man. This whole constructor is such a hindrance.
I wish Chili could talk more about it.
Anyway I really appreciate your help man!
I wish Chili could talk more about it.
Anyway I really appreciate your help man!
-
- Posts: 4373
- Joined: February 28th, 2013, 3:23 am
- Location: Oklahoma, United States
Re: [Snek Game] Constructor cannot be referenced
He does in other episodes.
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com