Make Error

安装好所有的东西后编译第一个tweak报错,好像是说theos/include中的头文件和XCode中的头文件定义冲突,找了半天也没找到解决方法,只好来请求帮助了。
编译报错如下:

Making all for tweak FirstTweak…
==> Preprocessing Tweak.xm…
==> Compiling Tweak.xm (armv7)…
While building module ‘UIKit’ imported from /opt/theos/Prefix.pch:22:
While building module ‘QuartzCore’ imported from /opt/theos/include/UIKit/UIKit-Structs.h:15:
In file included from :65:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.4.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/CoreAnimation.h:32:
/opt/theos/include/QuartzCore/CAValueFunction.h:13:1: error: duplicate interface
definition for class ‘CAValueFunction’
@interface CAValueFunction : NSObject {
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.4.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/CAValueFunction.h:9:12: note:
previous definition is here
@interface CAValueFunction : NSObject
^
While building module ‘UIKit’ imported from /opt/theos/Prefix.pch:22:
While building module ‘QuartzCore’ imported from /opt/theos/include/UIKit/UIKit-Structs.h:15:
In file included from :65:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.4.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/CoreAnimation.h:32:
/opt/theos/include/QuartzCore/CAValueFunction.h:17:39: error: property has a
previous declaration
@property(readonly, assign) NSString* name;
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.4.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/CAValueFunction.h:18:31: note:
property declared here
@property(readonly) NSString *name;
^
While building module ‘UIKit’ imported from /opt/theos/Prefix.pch:22:
In file included from :2:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:10:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIAccessibility.h:13:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIAccessibilityAdditions.h:10:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIPickerView.h:11:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UITableView.h:11:
In file included from /opt/theos/include/UIKit/UISwipeGestureRecognizer.h:10:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UISwipeGestureRecognizer.h:9:
In file included from /opt/theos/include/UIKit/UIGestureRecognizer.h:6:
/opt/theos/include/UIKit/UIKit-Structs.h:15:9: fatal error: could not build
module ‘QuartzCore’
#import <QuartzCore/QuartzCore.h>

In file included from <built-in>:341:
In file included from <command line>:5:
/opt/theos/Prefix.pch:22:12: fatal error: could not build module 'UIKit'
                       @import UIKit;
                        ~~~~~~~^~~~~
4 errors generated.
make[3]: *** [/Users/zhouye/Desktop/mytweaks/firsttweak/.theos/obj/debug/armv7/Tweak.xm.9f55e45b.o] Error 1
make[2]: *** [/Users/zhouye/Desktop/mytweaks/firsttweak/.theos/obj/debug/armv7/FirstTweak.dylib] Error 2
make[1]: *** [internal-library-all_] Error 2
make: *** [FirstTweak.all.tweak.variables] Error 2

把你的源代码po上来看看

Makefile:

ARCHS=armv7
include $(THEOS)/makefiles/common.mk

TWEAK_NAME = FirstTweak
FirstTweak_FILES = Tweak.xm
TARGET = iphone:latest:7.1
include $(THEOS_MAKE_PATH)/tweak.mk

after-install::
	install.exec "killall -9 SpringBoard"

Tweak.xm:

#import <version.h>

BOOL isEnabled = YES;
NSString* bString = @":D";

@interface SBScreenFlash : NSObject
+ (id)sharedInstance;
- (void)flash;
@end

@interface SBApplicationIcon : NSObject
- (void)flashScreen;
- (void)setBadge:(id)arg1;
@end

%hook SBApplicationIcon
- (void)launchFromLocation:(id)arg1 {
    [self flashScreen];
    %orig(arg1);
}

%new
- (void)flashScreen {
    SBScreenFlash* sbFlash = [%c(SBScreenFlash) sharedInstance];
    [sbFlash flash];
}
%end

%hook SBApplication
- (id)badgeNumberOrString
{
    id r=%orig;
    if(isEnabled) return bString;
    return r;
}
%end

这是啥?删了试试看

这是个定义版本的头文件,问题不在这里。即使是很简单的代码也是报一样的错,比如Tweak.xm改成如下:

%hook SBLockScreenDateViewController
- (void)setCustomSubtitleText:(id)arg1 withColor:(id)arg2
{
    %orig(@"My first Test",arg2);
}
%end

所以我觉得应该是环境没有装好。关于装Theos,ldid,替换dylib,下载头文件等步骤有太多的帖子,讲得又都不太一样,时间也都是很久前的了,我觉得可能是我的私有头文件下载得不对。请问有没有最新的安装整个开发环境的帖子,哪个git的theos是最新的,哪里下载的头文件是最新的等等。
我现在用来测试的手机是iPhone4,iOS 7.1.2
谢谢

版主还在吗?请回答一下好吗,感激不尽。

1 个赞

同问 老哥你解决了吗