Ask coding questions

← Back to all posts
Creating header files for a C++ class
kmcrae (21)

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 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.

mat1 (4428)

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

SPQR (592)

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

kmcrae (21)

@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.

JerryLatham (0)

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

BillyLandis (1)

@kmcrae can you share your solution?

MajidGomainy (0)

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