What does it mean by "Add definition in .cpp before compiling"

Hi i am sorry to be asking this because its probably quite easy
but what does it mean by Add definition in .cpp before compiling
thanks

The header files (.h) contain “declarations.” That just means setting up a road map for what will be contained in the .cpp file. The “definition” is the term used for the code written in the .cpp that corresponds to the header file. For example:

header file

void AThingToDo();

cpp

void WhateverClassThisIs::AThingToDo()
{

}

So I am guessing the video is talking about something that was written in the header file that has not been “defined” yet in the cpp. If you compile with declarations in a header that are not defined in the cpp the compile will fail. I am giving this answer not knowing the specifics of the video but I hope this helps.

Thank I feel so dumb I just thought because it’s in all caps it means something different lol

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms