Add new CPP file to plugin always fails to compile

Why does adding a new C++ class to a plugin always fails ? Simple blank plugin in this case?

Also if I add a simple C++ (blank) class with a function, include the module in my main application and call that function, it compiles, but at runtime complains that the entry point to that function is not found. Any suggestions?