Most online C++ compilers give you one editor, and one editor means one file. That's fine until your course splits a class into Student.h and Student.cpp . Then the second line of main.cpp stops the build:
code.cc:2:10: fatal error: Student.h: No such file or directory 2 | #include "Student.h" | ^~~~~~~~~~~ compilation terminated.
Enter fullscreen mode
Exit fullscreen mode
Here's why that happens, three ways around it, and the linker errors you'll meet on the way.
Why the include fails
#include "Student.h" tells the compiler to read Student.h from the folder of the file that includes it. A one-file online compiler saves your code on its own in an empty folder, so there is no Student.h to read.
Pasting in just the header doesn't fix it either. The header only declares the class; the member functions are defined in Student.cpp .…