Error:
\model\changeplayervisitor.cpp(3): error C2653: 'ChangePlayerVisitor' : is not a class or namespace name
The code for projectfolder/model/ChangePlayerVisitor.h
1 2 3 4 5 6 7 8 9 10 11 12 13
#include "TriggerVisitor.h"
class ChangePlayerVisitor : public TriggerVisitor // It tells the compiler that the class ChangePlayerVisitor 'inherits' publicly from the existing class TriggerVisitor.
{
public:
ChangePlayerVisitor(int to);
void visit(Trigger&);
void visit(Effect&);
void visit(Condition&);
private:
int _player;
};
Do I need StdAfx.cpp? Because if I create it and place:
#include "./model/StdAfx.h"
so it prints
visual studio 10.0\vc\include\xlocnum(133): error C2857: '#include' statement specified with the /YcStdAfx.h command-line option was not found in the source file
**************************
If I include
#include "./Model/TriggerVisitor.h"
in stdafx.h included from stdafx.cpp (first file included)
so I got error of redefinition
error C2011: 'TriggerVisitor' : 'class' type redefinition
but If I do not include
#include "TriggerVisitor.h"
in TrigXMLVisitor.h So I have plenty of errors missing this file I got error
\model\changeplayervisitor.cpp(3): error C2653: 'ChangePlayerVisitor' : is not a class or namespace name
> TriggerVisitor.h needs to be loaded before ChangePlayerVisitor.h
That shouldn't happen. Each header should be self contained, and the order of inclusion should make no difference.
You don't seem to be using headers guards, read http://www.cplusplus.com/forum/articles/10627/
> Should not TriggerVisitor.cpp be compiled before ChangePlayerVisitor.cpp
That would depend on your makefile, but it's irrelevant.
Should I first use the Precompiled headers options "Create" headers and then "Use" headers? I seems to me that it has not effect.
So I wait about 10 minutes till all the files are comiled, and then the last file resources.h which I inserted into stdafs.h prints error unexpected end of file. Is it because I inserted header guard into the file or should I not add it into stdafx?
unexpected end of file found: #endif // last line of H_resource
Also is there some way how to make fast check if all files which I try to include in the project have correct path or file name? It is silly to wait 10 minutes and then to read "file xyz.h does not exist"...
Compile only the unit that you are interested in, or just run the preprocessor for all.
> the last file resources.h which I inserted into stdafs.h prints error unexpected end of file
¿do you really expect me to diagnostic that with so little information?
The file didn't end well, it stopped at the middle of a
> Is it because I inserted header guard into the file or should I not add it into stdafx?
It is not a good idea to put includes in stdafx.h of files that would be changing a lot.
It defeats its purpose.
I still have problems with it. I have already compiled it successfully with Create (/Yc) option. It took cca 20 seconds. I don't know how could I compile only one unit (file cpp) do you mean key F7?.
But I cannot compile with Use (/Yu) options. It prints error that there are no pch files in Debug folder! However when I run it on Create options so no problem with it, only very short time waiting per one cpp file.