编译时Undefined symbols for architecture 问题求助

Undefined symbols for architecture armv7:
“_MSHookMessageEx”, referenced from:
logosLocalInit() in Tweak.xm.8fd5d85c.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [obj/first.dylib.ba964c90.unsigned] Error 1
make[1]: *** [internal-library-all
] Error 2
make: *** [first.all.tweak.variables] Error 2

用书里弹窗的例子,无论是armv7或者其它,都尝试过了,都报这个错误。知道的麻烦回答下吧

这种情况貌似是没有#import <substarte.h>所导致的,楼主最好把整段代码贴上来供大家判断

就书里3.2.4的例子而已。iphone 5 ,7.0.6系统测试

如果还有“libsubstrate.dylib, missing required architecture armv7 in file /Users/mcmillen/test/theos/lib/libsubstrate.dylib (2 slices)”的报错信息,那就是libsubstrate.dylib没有替换,具体解决方法书上已经有介绍

thanks,忘记这一步了

%hook SpringBoard
-(void)applicationDidFinishLaunching: (id)application //需要hook的消息名
{
%orig;
UIAlertView *alert = [UIAlertView alloc] initWithTitle:@“哈哈哈你中毒啦!” message:@"彪哥是一个正真的人类!!"delegate:self cancelButtonTitle:@“Thanks” otherButtonTitles:nil];
[alert show];
[alert release];
}
%end //结束标志就是书上的例子出的错啊,加入#import <substarte.h>还是和楼主一样得错误

Makefile内容是
ARCHS=armv7
include theos/makefiles/common.mk

TWEAK_NAME = iOSRE
iOSRE_FILES = Tweak.xm
simple_FRAMEWORKS = UIKit

include $(THEOS_MAKE_PATH)/tweak.mk

after-install::
install.exec “killall -9 SpringBoard”

出错提示是

xiaomindeiMac:iosre xiaomin$ make package
Making all for tweak iOSRE…
Linking tweak iOSRE…
Undefined symbols for architecture armv7:
"OBJC_CLASS$UIAlertView", referenced from:
objc-class-ref in Tweak.xm.4b5f35ab.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [obj/iOSRE.dylib.ba964c90.unsigned] Error 1
make[1]: *** [internal-library-all
] Error 2
make: *** [iOSRE.all.tweak.variables] Error 2

Tweak.xm的内容是

%hook SpringBoard
-(void)applicationDidFinishLaunching: (id)application //需要hook的消息名
{
%orig;
UIAlertView *alert = [UIAlertView alloc] initWithTitle:@“哈哈哈你中毒啦!” message:@"彪哥是一个正真的人类!!"delegate:self cancelButtonTitle:@“Thanks” otherButtonTitles:nil];
[alert show];
[alert release];
}
%end //结束标志

的“simple”是哪里来的?

哦,明白了,多谢大神指点,改成,Makefile内容simple_FRAMEWORKS = UIKit 为iOSRE_FRAMEWORKS = UIKit成功了,原来前缀要跟TWEAK_NAME一致