Either you have put main in the wrong file (it should be in what is considered the main file for the project) or you have have duplicated the code for main which would be a compile error being that you are trying to redefine main. |
Again, the main() can be in any compilation unit, although it is more intuitive if it is not in what (by name) looks "just a class implementation".
If same code (implementation) is in more than one unit, then the linker will give a "multiple definitions" error.
The OP, however, had "missing definitions" errors, which also come from the linking process (rather than actual compiler). The compiler has to be told to produce an object file from each compilation unit (.cpp file) and then the linker has to be given all those object files (and used libraries, which are precompiled collections of object code). The linker reports "undefined reference" if it is not given all the relevant object code.
Either no object file was compiled from the wheel.cpp or that object file was not a parameter in the linker call.
One can run all the necessary compilation command manually from command line. That gets tedious.
There is a family of "make" commands that read and execute compilation commands from "makefile". The makefile is a recipe to compile and make runs only the necessary subcommands. For example, changing wheel.cpp and calling make will recompile only the wheel and link, if bike.cpp was not changed and its "up to date" object file still exists.
The makefile is specific to a platform and semitedious to write manually. There are multiple tools (e.g. GNU build system, cmake, qmake) that generate a makefile suitable for the platform from their own recipes. An IDE and its "project" is such a tool.