why does the complier complain undeclare identifier even though i have included the header file?

T

thinktwice

my project contains tens of files, it compiles well . now i need to add
several class implementation files to the project which are similar
with the classes already exist in
the project, so i add new files and copy the code from the exsited
files(sure need some
modification). but the compiler complains 'classxxx" undeclared
identifier.
 
V

Victor Bazarov

thinktwice said:
my project contains tens of files, it compiles well . now i need to
add several class implementation files to the project which are
similar with the classes already exist in
the project, so i add new files and copy the code from the exsited
files(sure need some
modification). but the compiler complains 'classxxx" undeclared
identifier.

This is covered in the FAQ. See 5.8 and 5.9.

V
 
J

Jim Langston

thinktwice said:
my project contains tens of files, it compiles well . now i need to add
several class implementation files to the project which are similar
with the classes already exist in
the project, so i add new files and copy the code from the exsited
files(sure need some
modification). but the compiler complains 'classxxx" undeclared
identifier.

Most likely causes are mistyped class names (MyClass instead of myclass for
instance, MyClas for another instance), include files not included where
they should be, improper include guards (did you change the include guards
to match your header and make sure no other header used the same defines?).
 
D

Daniel T.

"thinktwice said:
my project contains tens of files, it compiles well . now i need to add
several class implementation files to the project which are similar
with the classes already exist in
the project, so i add new files and copy the code from the exsited
files(sure need some
modification). but the compiler complains 'classxxx" undeclared
identifier.

It's complaining because you haven't properly declared classxxx in the
context in which it is complaining about. I know that seems pretty
obvious, but there you go.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top