未知类型名称类 [英] Unknown type name class

查看:87
本文介绍了未知类型名称类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下头文件:

https:// gist .github.com / wemakeweb / 5501443
,编译器将始终报告未知类型名称类 。我加入了前瞻性声明,以打破包括在内的通报,我认为我必须这样做。我忘记了什么?

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?

编辑:我将它们全部放在一个头文件中,并且编译器仍然在顶层声明符之后报告 expected;;

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

编辑2
现在,我收到链接器错误。 体系结构x86_64的未定义符号

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

已解决,问题已解决


  1. 包含

  2. main.c而不是main.cpp

  3. 实际代码在静态lib中,未正确链接


推荐答案

此错误? 错误:未知类型名称'class'

您可能将其编译为C而不是C ++。

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

请确保您的源文件具有 .cpp 扩展名,然后正确设置所有相关的编译器标志。 (如果您包含 exact 错误消息和行号,将很有帮助。不要尝试重新输入,只需剪切+粘贴。)

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.)

这篇关于未知类型名称类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆