Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/actionscript-3/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c Xcode 4.2中的未知类型名称“namespace”_Objective C_Xcode4.2_Vuforia - Fatal编程技术网

Objective c Xcode 4.2中的未知类型名称“namespace”

Objective c Xcode 4.2中的未知类型名称“namespace”,objective-c,xcode4.2,vuforia,Objective C,Xcode4.2,Vuforia,我正在编译QCARSDK,但在我向项目中添加了更多框架后,它会提示一个错误 // 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 };

我正在编译QCARSDK,但在我向项目中添加了更多框架后,它会提示一个错误

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

我怀疑翻译是C或Objto-C,命名空间不是C++和Objul-C++的关键字。
另一种可能性是前一个标题没有关闭主体,例如遗忘};类结束时声明遗忘}函数定义结束时。

您可以使用.mm重命名文件,也可以选择.m文件并将文件类型更改为Objective-C++源代码


这可能是xCode 4.2和QCAR SDK 1.0之间的兼容性问题。请参阅:require QCAR SDK Login@Shivan MoSR与我的建议相同。如果您编辑帖子并为产生错误的文件添加生成脚本,那么我可以验证情况是否如此。@Shivan您正在编译的文件是一个.m文件,用于objc。在转录本的开头缺少命令调用,因此我不能确定编译器是否被告知将文件编译为objc++。那么,试试这个:将扩展名从CouponBook.m更改为CouponBook.mm。对于.mm,除非您在其他地方明确禁用了该行为,否则该文件将编译为objc++文件。对于编译器在同一翻译中识别C++和Objc程序,需要编译为Objc++。在我重命名为.mm后,问题消失了。谢谢你的帮助!未来读者注意:QCAR现在被重命名为Vulforia,在这里,上述错误不会再次出现在任何示例项目中。
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.