首页 > 解决方案 > 在 C 类中导入 OBJ-C 变量

问题描述

我有一个我无法解决的问题。我必须在我的 .c 类中使用在目标 C 文件头中声明的变量。为此,我在 .c 文件中使用此代码:

#ifdef __OBJC__
   #import "RilieviTableViewController.h"
#endif

但是当我尝试使用该对象时,xcode 说我“使用了未声明的标识符 semBtnPressed”。在我的 obj C 头文件中,我以这种方式声明了该对象:

#import <UIKit/UIKit.h>
#include <AudioToolBox/AudioToolBox.h>
#include "starrec_pal_sema.h"

static id refToSelf;
static StarRec_PAL_Sema *semBtnPressed; // <-- variable i want to import.


@interface RilieviTableViewController : UITableViewController
// other variable that i don't have to import.
@end

该项目使用 Nuance 库,并且该对象是 Nuance 对象。在示例中,他们只是在 ifdef 块中导入类,但在我的情况下它不起作用。每个人都可以有解决方案吗?

标签: objective-ccxcodenuance

解决方案


推荐阅读