You tagged your question with MFC. Then precompiled headers are used by default which requires including
stdafx.h.
So I guess that you forgot to include
stdafx.h in your source file.
Then
stdafx.h very likely includes
atlbase.h already (directly with an include statement or indirectly by other files). Because your files compile without error when not including
atlbase.h in the source files this will be the case here (otherwise there would be errors about unknown identifiers).
I'm not quite sure what really happened but forgetting to include that file can have many side effects.
Note also that
afxwin.h is also already included by
stdafx.h. So the top of your source file should look like:
#include "stdafx.h"
#include "Student.h"
#include "Teacher.h"
#include "Settings.h"
#include "About.h"
#include "BaseDlg.h"
#include "Label.h"
#include "XPButton.h"