[Solved] error C2653: ‘User’ : is not a class or namespace name [closed]


Here are some steps that I would take when facing these problems:

  • error C2653: 'User' : is not a class or namespace name is about one of your user-defined types. Check the line that this error occurs on and see whether you can spot the problem (by the way, it might have been really helpful if you told us which line that error occurs on instead of giving us 4 files and saying that it’s somewhere in there!). If not, then…
  • …you are probably facing some #include/namespace nightmare.
  • Get rid of using namespace std;. As a temporary solution, you can import what you need by using std::string; etc, but for a sustainable long-term approach, read Herb Sutter’s article at: http://www.gotw.ca/gotw/053.htm
  • Remove all unneccessary #includes from your files. Only ever include what you actually need!
  • Your combination of #pragma once and manual include guards seems weird to me. I don’t think it would cause problems, but I’d stick with one of the two.
  • Remove stadfx.h from your includes and disable precompiled headers in your project options. Rebuild your project. (I’m not saying precompiled headers are bad, but I would take them out until you have fixed your problems.)

solved error C2653: ‘User’ : is not a class or namespace name [closed]