Actor components not saving after closing the editor c++

Hi, im very new to unreal engine so im not sure if this is a common problem or not. When I add a custom actor component or scene component to an object in unreal engine, after closing it and re-opening it the components are gone. They dont even show up in the components list unless I re-compile the code. Trying to build the code without the editor open gives me this error in the visual studio terminal tab:
ERROR: Targets cannot be built in the Debug configuration with this engine distribution.
Not sure whats going on, please help!