Compilation error cpp | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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

30th Jul 2019, 5:44 PM
MargK645
5 Answers
+ 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. 😅
30th Jul 2019, 6:02 PM
Aakaanksha 💕 [TheBraveCoders]
Aakaanksha 💕 [TheBraveCoders] - avatar
+ 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.
30th Jul 2019, 6:10 PM
Aakaanksha 💕 [TheBraveCoders]
Aakaanksha 💕 [TheBraveCoders] - avatar
+ 1
Aakaansha💕 i have included the first code in the second : https://code.sololearn.com/cq07Hj6xEqG8/?ref=app
30th Jul 2019, 6:06 PM
MargK645
+ 1
Aakaansha💕 thank you I have included "soldier.h" but I still get the same error. I don't know why is this happening :(
30th Jul 2019, 6:35 PM
MargK645
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
30th Jul 2019, 7:01 PM
MargK645