Xcode 4.2中的未知类型名称'namespace'

问题描述 投票:12回答:2

我正在编译QCAR SDK,但是在我向项目中添加了更多框架之后,它会提示错误。

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

我正在编译QCAR SDK,但是在我向项目中添加了更多框架之后,它会提示错误。 // Matrices.h // #ifndef _QCAR_MATRIX_H_ #define _QCAR_MATRIX_H_名称空间QCAR {///矩阵为3 ...

objective-c xcode4.2 vuforia
2个回答
17
投票

我怀疑翻译是C或Objective-C,其中namespace不是关键字,就像在C ++和Objective-C ++中一样。


19
投票

您可以使用.mm重命名文件,也可以选择.m文件,然后将“文件类型”更改为“ Objective-C ++源”。

© www.soinside.com 2019 - 2024. All rights reserved.