不能使用 typedef 枚举
Can't use typedef enum
我有一个 header 文件,其定义为:
typedef enum acamera_metadata_enum_android_lens_facing {
// enumeration
} acamera_metadata_enum_android_lens_facing_t;
问题是当我尝试将此枚举声明为我的 class 成员时,编译器找不到定义(找到 header)。
../../../../src/main/cpp/include/camera_manager.h:41:9: error: unknown type name 'acamera_metadata_enum_android_lens_facing_t'
acamera_metadata_enum_android_lens_facing_t facing;
这是我的 class header:
#ifndef DAVINCI_CAMERA_MANAGER_H
#define DAVINCI_CAMERA_MANAGER_H
#include <map>
#include <string>
#include <camera/NdkCameraManager.h>
#include <camera/NdkCameraError.h>
#include <camera/NdkCameraDevice.h>
#include <camera/NdkCameraMetadataTags.h> // The enumeration is defined here
#include <media/NdkImageReader.h>
namespace DaVinci {
class CameraId;
class CameraManager {
struct ACameraManager *_manager;
std::map<std::string, CameraId> _cameras;
std::string _activeCameraId;
int32_t _cameraFacing;
int32_t _cameraOrientation;
bool _valid;
public:
CameraManager();
~CameraManager();
};
// helper classes to hold enumerated camera
class CameraId {
public:
struct ACameraDevice *device;
std::string id;
acamera_metadata_enum_android_lens_facing_t facing;
bool available; // free to use ( no other apps are using
bool owner; // we are the owner of the camera
explicit CameraId(const char *id);
explicit CameraId();
};
};
#endif //DAVINCI_CAMERA_MANAGER_H
问题出在哪里?
P.S. 如果它很重要,我正在使用 c++ 14。
已更新
我用我的项目创建了一个存储库:https://bitbucket.org/ghostman2013/davinci_test
在您项目的 app/build.gradle
中,您已将 minSdkVersion
设置为 21。
原生相机 API were added in API level 24。
因此您可以 A) 将 minSdkVersion
增加到 24 或更高,或者 B) 不使用库中的原生相机 API。
我有一个 header 文件,其定义为:
typedef enum acamera_metadata_enum_android_lens_facing {
// enumeration
} acamera_metadata_enum_android_lens_facing_t;
问题是当我尝试将此枚举声明为我的 class 成员时,编译器找不到定义(找到 header)。
../../../../src/main/cpp/include/camera_manager.h:41:9: error: unknown type name 'acamera_metadata_enum_android_lens_facing_t'
acamera_metadata_enum_android_lens_facing_t facing;
这是我的 class header:
#ifndef DAVINCI_CAMERA_MANAGER_H
#define DAVINCI_CAMERA_MANAGER_H
#include <map>
#include <string>
#include <camera/NdkCameraManager.h>
#include <camera/NdkCameraError.h>
#include <camera/NdkCameraDevice.h>
#include <camera/NdkCameraMetadataTags.h> // The enumeration is defined here
#include <media/NdkImageReader.h>
namespace DaVinci {
class CameraId;
class CameraManager {
struct ACameraManager *_manager;
std::map<std::string, CameraId> _cameras;
std::string _activeCameraId;
int32_t _cameraFacing;
int32_t _cameraOrientation;
bool _valid;
public:
CameraManager();
~CameraManager();
};
// helper classes to hold enumerated camera
class CameraId {
public:
struct ACameraDevice *device;
std::string id;
acamera_metadata_enum_android_lens_facing_t facing;
bool available; // free to use ( no other apps are using
bool owner; // we are the owner of the camera
explicit CameraId(const char *id);
explicit CameraId();
};
};
#endif //DAVINCI_CAMERA_MANAGER_H
问题出在哪里?
P.S. 如果它很重要,我正在使用 c++ 14。
已更新
我用我的项目创建了一个存储库:https://bitbucket.org/ghostman2013/davinci_test
在您项目的 app/build.gradle
中,您已将 minSdkVersion
设置为 21。
原生相机 API were added in API level 24。
因此您可以 A) 将 minSdkVersion
增加到 24 或更高,或者 B) 不使用库中的原生相机 API。