Xcode 4.2 中的未知类型名称“命名空间" [英] Unknown type name 'namespace' in Xcode 4.2

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

问题描述

我正在编译QCAR SDK,但在项目中添加更多框架后提示错误.

I am compiling QCAR SDK, but it prompts an error after I added more frameworks to the project.

// Matrices.h
//
#ifndef _QCAR_MATRIX_H_
#define _QCAR_MATRIX_H_

namespace QCAR
{

/// Matrix with 3 rows and 4 columns of float items
struct Matrix34F {
    float data[3*4];   ///< Array of matrix items
};


/// Matrix with 4 rows and 4 columns of float items
struct Matrix44F {
    float data[4*4];   ///< Array of matrix items
};

} // namespace QCAR

#endif //_QCAR_MATRIX_H_

在行 namespace QCAR 中,它表示 Unknown type name 'namespace'.

In the line namespace QCAR, it said Unknown type name 'namespace'.

我该怎么办?

更新:这是构建记录

In file included from ../../build/include/QCAR/Tool.h:18:
In file included from /Users/Raptor.Kwok/Documents/xCodeProjects/qcar-ios-1-0-0/samples/ImageTargets/ImageTargets/EAGLView.h:14:
In file included from /Users/Raptor.Kwok/Documents/xCodeProjects/qcar-ios-1-0-0/samples/ImageTargets/ImageTargets/ImageTargetsAppDelegate.h:9:
In file included from /Users/Raptor.Kwok/Documents/xCodeProjects/qcar-ios-1-0-0/samples/ImageTargets/CouponBook.m:12:
../../build/include/QCAR/Matrices.h:16:1: error: unknown type name 'namespace' [1]
 namespace QCAR
 ^
../../build/include/QCAR/Matrices.h:16:15: error: expected ';' after top level declarator [1]
 namespace QCAR
               ^
               ;
fix-it:"../../build/include/QCAR/Matrices.h":{16:15-16:15}:";"
In file included from /Users/Raptor.Kwok/Documents/xCodeProjects/qcar-ios-1-0-0/samples/ImageTargets/ImageTargets/ImageTargetsAppDelegate.h:9:
In file included from /Users/Raptor.Kwok/Documents/xCodeProjects/qcar-ios-1-0-0/samples/ImageTargets/CouponBook.m:12:
/Users/Raptor.Kwok/Documents/xCodeProjects/qcar-ios-1-0-0/samples/ImageTargets/ImageTargets/EAGLView.h:52:5: error: type name requires a specifier or qualifier [1]
     QCAR::Matrix44F projectionMatrix;
     ^
/Users/Raptor.Kwok/Documents/xCodeProjects/qcar-ios-1-0-0/samples/ImageTargets/ImageTargets/EAGLView.h:52:10: error: expected expression [1]
     QCAR::Matrix44F projectionMatrix;
          ^
/Users/Raptor.Kwok/Documents/xCodeProjects/qcar-ios-1-0-0/samples/ImageTargets/ImageTargets/EAGLView.h:52:5:{52:5-52:9}: warning: type specifier missing, defaults to 'int' [-Wimplicit-int,3]
     QCAR::Matrix44F projectionMatrix;
     ^~~~
1 warning and 4 errors generated.

推荐答案

我怀疑翻译的是 C 或 Objective-C,其中 namespace 不是关键字,因为它在 C++ 和 Objective-C++ 中.

I suspect the translation is C or Objective-C, where namespace is not a keyword as it is in C++ and Objective-C++.

另一种可能是前一个头文件没有关闭主体(例如,在类声明结束时忘记了 }; 在函数定义结束时忘记了 }).

Another possibility is that a previous header did not close a body (e.g. forgotten }; at end of class declaration of forgotten } at end of function definition).

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

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