【问题标题】:Unknown type name namespace未知类型名称命名空间
【发布时间】:2014-07-23 08:46:19
【问题描述】:

我目前正在处理 Android 原生代码。我有Accessorries.h

Accessories.h
#ifndef _ACCESSORIES_H_
#define _ACCESSORIES_H_
#define ANDROID    1
#include <string>
#include <opencv2/contrib/detection_based_tracker.hpp>
using namespace std;
using namespace cv;


#ifdef __cplusplus
extern "C" {
#endif

#define RETURN_OK  0
#define RETURN_MEMORY_ERROR 1
#define RETURN_PROCESS_ERROR  2
#define FACESIZE   0.2
#define WIDTH      400
#define HEIGHT     300

typedef struct{
     int col;
     int row;
     int width;
     int height;
}loc_rects;

typedef struct{

     int numofppl;
     int camera_idx;
     unsigned char *frame;//image buffer
     loc_rects *locs;
}container;

typedef struct{
   int ctrl;
   string frontxml;
   string profilexml;
}processParam;


typedef struct{
    DetectionBasedTracker::Parameters DetectorParams;
    DetectionBasedTracker front;
    DetectionBasedTracker profile;
}detectors;

#ifdef __cplusplus
}
#endif
#endif

Accessories.h 包含在 Detection.h &amp; Detection.cppcamera.c 中。 unknown type name namespace 有很多错误。 我使用 ndk-build 编译本机代码。 有什么问题? 我有路径和符号设置,如附图所示。 我为 GNU C 和 GNU C++ 设置了相同的设置。

编辑: 这是错误之一

C:/ndk/sources/cxx-stl/gnu-libstdc++/4.6/include/bits
/stl_vector.h:65:1: error: unknown type name 'namespace'
C:/ndk/sources/cxx-stl/gnu-libstdc++/4.6/include/bits
/stl_vector.h:66:1: error: expected ',' or ';' before '{' token
In file included from C:/ndk/sources/cxx-stl/gnu-libs
tdc++/4.6/include/vector:66:0,
                 from C:/Count//jni/include/opencv2/contrib/
detection_based_tracker.hpp:8,
                 from C:/Count//jni/Accessories.h:5,
                 from C:/Count//jni/FaceDetection.h:3,
                 from C:/Count//jni/com_astralink_orcas_api_

谢谢

【问题讨论】:

  • hii 你能粘贴确切的错误吗
  • 不,我只包含在 Detection.h 和 Camera.c 中。
  • 好的,您是否收到包含类似asm ; ; ; ; ; redefinition was found here的错误信息
  • @yanivx 是的,我也得到了这些

标签: c++ c opencv android-ndk


【解决方案1】:

using namespace 仅适用于 C++。对这些声明使用#ifdef __cplusplus

【讨论】:

  • 看起来您包含的文件 - detection_based_tracker.hpp - 仅是 C++。也许将所有东西都构建为 C++?
  • 我全部注释掉。然后我一一包括。一旦我包含#include 。我得到了那些命名空间错误。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2011-12-19
  • 1970-01-01
  • 2013-03-25
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多