简体   繁体   English

_OBJC_CLASS _ $ _ RscMgr链接器错误

[英]_OBJC_CLASS_$_RscMgr Linker error

Please excuse any minor mistakes, being my first question... Feedback still appreciated though. 请原谅任何小错误,这是我的第一个问题。

I've been trying to use a Redpark cable, in order to communicate between an iPhone and an Arduino (Mini Arduino Pro). 我一直在尝试使用Redpark电缆,以便在iPhone和Arduino(迷你Arduino Pro)之间进行通信。 The project has failed to build with my coding. 该项目无法使用我的编码进行构建。 I've searched around for days for a solution, but what has worked for others hasn't worked for me. 我已经搜寻了几天的解决方案,但是对别人有用的对我却无效。
This is my error: 这是我的错误:

Undefined symbols for architecture armv7: 架构armv7的未定义符号:
"_OBJC_CLASS_$_RscMgr", referenced from: 从以下位置引用的“ _OBJC_CLASS _ $ _ RscMgr”
objc-class-ref in ViewController.o ViewController.o中的objc-class-ref
ld: symbol(s) not found for architecture armv7 ld:找不到架构armv7的符号
clang: error: linker command failed with exit code 1 (use -v to see invocation) clang:错误:链接器命令失败,退出代码为1(使用-v查看调用)

However, I have found that this line of code has been the problem factor. 但是,我发现这行代码一直是问题所在。 (As in, if it is removed, the project build will succeed, but will not work.) (例如,如果将其删除,则项目构建将成功,但将无法进行。)

Inside ViewController.m -(void)viewDidLoad 内部ViewController.m-(void)viewDidLoad

rscMgr = [[RscMgr alloc] init];

Frameworks ("Link Binary With Libraries"): ExternalAccessory, UIKit, MediaPlayer, CoreGraphics, Foundation. 框架(“使用库链接二进制文件”):ExternalAccessory,UIKit,MediaPlayer,CoreGraphics,Foundation。

ViewController.h (With unnecessary stuff removed) ViewController.h(除去不必要的内容)
#import <UIKit/UIKit.h> #import "RscMgr.h"
@interface ViewController : UIViewController <RscMgrDelegate> {
RscMgr *rscMgr;
}
@property (nonatomic, retain) RscMgr *rscMgr;
@end


ViewController.m (With unnecessary stuff removed) ViewController.m(除去不必要的内容)
#import "ViewController.h"
#import "RscMgr.h"
@implementation ViewController
@synthesize rscMgr;
- (void)viewDidLoad
{
[super viewDidLoad];
rscMgr = [[RscMgr alloc] init];
[rscMgr setDelegate:self];
}
-(void) cableConnected:(NSString *)protocol{
[rscMgr setBaud:9600];
[rscMgr open];
}
@end


Links to RscMgr.h and redparkSerial.h 链接到RscMgr.hredparkSerial.h

There are no .m files for both redparkSerial.h and RscMgr.h redparkSerial.h和RscMgr.h都没有.m文件

This is a linker error. 这是一个链接器错误。 You are referencing the library headers files correctly, so the compiler can compile the individual files into object files, but when the linker comes to join them all together into an application, it is finding that the library itself is not present. 您正确地引用了库头文件,因此编译器可以将单个文件编译为目标文件,但是当链接程序将它们全部连接到应用程序中时,就会发现该库本身不存在。 You need to add the library itself to your project. 您需要将库本身添加到项目中。 The headers only describe the interface to it, they don't include the library itself. 标头仅描述其接口,不包括库本身。

To do this in recent versions of Xcode, you can usually just drag the static library (a file ending in .a ) into your project. 要在最新版本的Xcode中执行此操作,通常只需将静态库(以.a结尾的文件)拖到项目中即可。 But you should really check the documentation for this library and follow its recommended installation procedure. 但是您应该真正查看该库的文档,并遵循其建议的安装过程。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM