2011-11-02 18 views
10

私はQCAR SDKをコンパイルしていますが、プロジェクトにフレームワークを追加した後にエラーを表示します。ラインnamespace QCARxCode 4.2で不明な型名 'namespace'がありますか?

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

、それはUnknown type name 'namespace'言いました。

どうすればよいですか?

UPDATE:ここでは、ビルド転写産物は、私は翻訳がCか、C++とObjective-C++であるようnamespaceがキーワードではありませんのObjective-C、である疑いがある

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. 
+0

**将来の読者への注意:** QCARは現在、上記のエラーは、サンプルプロジェクトのいずれにも再び表示されませんVulforia、に変更されます。 – Raptor

答えて

15

です。

もう1つの可能性は、前のヘッダがボディを閉じなかったことです(関数定義の最後で、クラス宣言の末尾にある忘れた};を忘れて})。

+0

おそらく、xCode 4.2とQCAR SDK 1.0の間に互換性の問題があります。参照:https://ar.qualcomm.com:443/arforums/showthread.php?t=1079(QCAR SDKログインが必要) – Raptor

+1

@Shivan MoSRは私が作成したのと同じ提案をしていました。投稿を編集してエラーを生成するファイルのビルドトランスクリプトを追加すると、これが正しいかどうかを検証できます。 – justin

+0

トランスクリプトを作成します。 – Raptor

16

ファイルの名前を.mmに変更するか、.mファイルを選択して "ファイルタイプ"を "Objective-C++ Source"に変更することができます。

filetype

関連する問題