本文介绍了iphone错误:在''foo'之前预期'=',',',';','asm'或'__attribute__'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将speakhere示例移植到另一个应用程序中,我遇到了问题。我复制了所有文件和所有框架,但由于某种原因,我得到了一堆我以前从未见过的编译错误,因此不知道该怎么做。唯一的区别是我没有起诉IB,所以我不得不稍微改变它。

I'm trying to port the speakhere example into another app and I'm having issues. I copied all the files, and all the frameworks, but for some reason I get a bunch of compile errors that I've never seen before and thus don't know what to do. The only difference is that i'm not suing IB and so i had to change it slightly.

在'foo'之前错误:预期'=',',',';','asm'或'__attribute__' / code>是什么意思?...我为不同的文件多次出现此错误

What does error: expected '=', ',', ';', 'asm' or '__attribute__' before 'foo' mean?... I get this error multiple times for different files

在我的情况下,第一个错误指向'MeterTable'.. a包含< stdlib.h> < stdio.h> <的类;文件math.h> 。但这些文件似乎导入正常(如果我删除它我会得到更多的错误)

In my situation the first error is pointing at 'MeterTable'.. a class that includes <stdlib.h>,<stdio.h> and <math.h>. But those files seem to be importing fine (if i remove them i get more errors)

有关如何调试这个的任何建议吗?

Any suggestions on how to debug this?

TIA!

编辑:
我似乎无法弄明白。我只是将文件从示例复制到另一个项目中。有人可以看看吗? ,原文在这里

推荐答案

您的问题是您正在编译SpeakHerePortAppDelegate.m,这是一个Objective C文件,但是它间接包含MeterTable.h这是一个C ++头文件。

Your problem is that you are compiling SpeakHerePortAppDelegate.m, which is an Objective C file, but it is indirectly including MeterTable.h which is a C++ header file.

将它重命名为SpeakHerePortAppDelegate.mm(double m),以便将其编译为Objective C ++并解决您的问题。

Rename it to SpeakHerePortAppDelegate.mm (double m) so that it is compiled as Objective C++ and your problem is resolved.

将所有文件命名为.mm然后全部您的代码将编译为Objective C ++

Name all your files .mm and then all your code will be compiled as Objective C++

这篇关于iphone错误:在''foo'之前预期'=',',',';','asm'或'__attribute__'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 06:06