Search code examples
c++syntaxidentifier

C++ just a syntax error: syntax error : identifier


I feel so dumb right now:

moveSequence look(COORD xyBeatle, fieldd &field);

what could be so wrong about that, to give a syntax error?

error C2061: syntax error : identifier 'fieldd'

What I am trying to do is pass an a reference of a class fieldd to look() via:

moveSequence sequence = look(xy, m_field);

It doesn't seem to recognize the type field

Actually I am being littered with errors all about things that should be type field are having type int assumed ect..

This is after a long week of refactoring and not even getting back to the point of compiling so I cannot tell what change immediately caused this.


edit: now I am noticing that intellisense is underlining, for only a moment, intermittently the places where the compiler is throwing real errors..... I disabled PCH and rebuilt but this didn't work.


edit2: The variable name was NOT the problem, that was one of the first things I Tried.


edit3: I was finally able to catch one of the intellisense errors and it read "identifier "fieldd" is undefined" before shortly changing to "class fieldd" I think this might be a problem with the headers. this guys problem was headers: http://www.gamedev.net/topic/555445-solvederror-c2061-syntax-error--identifier-t3dobject/


Solution

  • We really need more code to identify your problem but I wonder if you need to forward declare fieldd since you have refactored the code into different files, perhaps the headers are not included correctly or the dependencies no longer make sense?

    changing your declaration to: moveSequence look(COORD xyBeatle, class fieldd &field) might give you more information.