I have a whatever.cpp file that contains several functions that are called from main.
One of the functions in whatever.cpp calls another function that is defined in main. One of the functions in whatever.cpp references several identifiers that are defined in main.
The functions and identifiers from main are not recognized in whatever unless i #include main in some way but when I do I get linker errors.
Am I missing something fundamental? Duh. Any thoughts on what I'm not understanding?
It is common for beginners to be given assignments with a file named "main.cpp". When they branch to multiple source files, it is possible that some of the functions defined in "main.cpp" need to be called by functions in other .cpp files. In this case, it is fine to have, say, a "main.h" file that prototypes the functions you may call in "main.cpp".
You should never explicitly call the program entry point function, main(). It is a special function that should only be called by the OS.
All that said, it is an indicator of bad design to have to call functions in the main module (module == .cpp file). Such functions should be moved out into their own separate module (.cpp file). Ideally the "main.cpp" file should only contain the main() function (beginner's rule of thumb).