Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.3k views
in Technique[技术] by (71.8m points)

c++ - Unknown type name class

I have the following header files:

https://gist.github.com/wemakeweb/5501443 and the compiler always reports "Unknown Type name Class". I have included Forward Declaration, to break circular including , where i think i have to. What did i forget?

Edit: i put it all in one header file, and the compiler still reports "expected ; after top level declarator"

https://gist.github.com/wemakeweb/5583500

Edit 2 Now im getting linker errors. "Undefined symbols for architecture x86_64"

Solved, Problems were

  1. Circular Including
  2. main.c instead of main.cpp
  3. the actual code was in a static lib which was not linked properly
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

This error? error: unknown type name ‘class’

You're probably compiling it as C rather than C++.

Make sure your source file has a .cpp extension, and than any relevant compiler flags are set correctly. (It helps if you include the exact error message and line numbers. Don't try and retype, just cut+paste.)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...