开发者

C++ non-sensical errors: c2629 "Unexpected class", c2065: 'ceil' undeclared identifer [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly r开发者_JAVA技巧eopened, visit the help center for guidance. Closed 10 years ago.

I had a program working yesterday, moved one function from one class in one file to another class/file, and all of a sudden I got a series of non-sensical errors:

  • c2629: Unexpected class blahblah at the beginning of several header files
  • c2065: 'ceil' undeclared identifier
  • c2039: xxxx is not a member of namespace yyyy (when it most certainly is, and the file is included)

I've spent about a day now trying to figure out what's going on, and I can't figure it out. There's 50+ files so no point in posting the code, so I guess my question is, what sorts of things do you look for in order to debug errors like this?

I've checked:

  • Making sure there's proper header guards in all .h files
  • Making sure all classes have semicolons at the end
  • Putting "using" directives only in .cpp files, or else in a namespace
  • Looking for mismatched curly brackets

I'm at wits end. Sorry for the lack of code/information. Appreciate any help, thanks.


Always start with the first error and solve that first. Don't get bogged down by the loads of errors since the compiler may be lose its sense of grammar on the first nasty error (typically a missing semicolon after a struct/class).


When you copied the function definition, did you replace the class name in that function definition with the new class? ie.

void oldclass::func()
{
}

becomes:

void newclass::func()
{
}

i know it sounds trivial... but you did ask for suggestions :D


Check that you haven't inserted some character at the start of one of your source files by mistake. This has happened to me a few times, and can give strange errors in the included header files.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜