Skip to content
← Back to Community
Creating header files for a C++ class
Profile icon
kmcrae

I have a classroom set up for my C++ students and we are now learning about creating our own classes. I need to be able to define the class structure in a file saved as a header file. Can this be done on Repl.it? I tried just naming it with the .h extension but I get all kinds of errors related to not knowing what the Class type is, which I am sure relates to the header file.

Voters
Profile icon
SaberSahabzada
Profile icon
Zuyingg
Profile icon
kmcrae
Comments
hotnewtop
Profile icon
mat1

The error should mention what file and line it's on. Can you please give us the full error and repl link? Thanks.

Profile icon
SPQR

Could you link the repl? That way we'll be able to see exactly what's wrong :)

Profile icon
kmcrae

@SPQR I actually got it to work now. Thanks for replying. It was just an inconsistent naming issue that I didn't see at first.

Profile icon
JerryLatham

How did you get it to work? I am trying to do the same thing, but the lecture is using code [email protected]

Profile icon
BillyLandis

@kmcrae can you share your solution?

Profile icon
MajidGomainy

@SPQR Though is not related! How can we use the OpenGL for c++ in repl.it?