Compilation error cpp | SoloLearn: Learn to code for FREE!

+1

Compilation error cpp

Hello guys? Can anyone help me with this cpp error? When I write Board[1][0]= new Soldier(true,0,1,*this); I get an error saying that Soldier does not name a type even though I have included it https://code.sololearn.com/c9PwApGhQhfM/?ref=app https://code.sololearn.com/cq07Hj6xEqG8/?ref=app

7/30/2019 5:44:00 PM

MargK645

6 Answers

New Answer

+11

don't create 2 separate code. U have to declare all in 1 code sadly, SoloLearn don't allow to access from 2 separate code. So just put it all in 1 code. 😅

+11

#include "piece.h" #include "rook.h" #include "knight.h" #include "bishop.h" #include "queen.h" #include "king.h" #include "soldier.h" MargK645 These aren't any standard library hence they aren't available here in sololearn.

+3

This should help you deal with this type of error: https://stackoverflow.com/questions/2133250/x-does-not-name-a-type-error-in-c/2133260

+1

Aakaansha💕 i have included the first code in the second : https://code.sololearn.com/cq07Hj6xEqG8/?ref=app

+1

Aakaansha💕 thank you I have included "soldier.h" but I still get the same error. I don't know why is this happening :(

0

Ace thank you very much! The problem is that I have done this procedure for the other figures and it was ok but now my Soldier figure has this compilation problem. I have checked if I haven't included something correctly but I find everything to be ok