Using a plugin in C++ code

You need to add CustomMeshComponent to your private or public dependencies in your module’s build.cs file as the first answer indicates.