int pAddress = 0x31c3f31;
int* addressValue = (int*)pAddress;
报错:
Tweak.xm:346:25: error: cast to 'int ’ from smaller integer type ‘int’
[-Werror,-Wint-to-pointer-cast]
int addressValue = (int*)pAddress;
int pAddress = 0x31c3f31;
int* addressValue = (int*)pAddress;
报错:
Tweak.xm:346:25: error: cast to 'int ’ from smaller integer type ‘int’
[-Werror,-Wint-to-pointer-cast]
int addressValue = (int*)pAddress;
修改Makefile加-Wno-XXXX
好的,谢谢了
int* addressValue = (int*)(intptr_t)pAddress;
受教了,谢谢
张总,我用logify.pl导出一个头文件到tweak.xm时,也遇到类似的错误提示。
插件中是这样hook的:
然后make时提示示CDUnknownBlockType未定义,于是我自己增加了个定义:
typedef void (^CDUnknownBlockType)(void);
然后make时,显示错误提示:
==> Compiling Tweak.xm (arm64)…
Tweak.xm:9:301: error: cast from pointer to smaller type ‘unsigned int’ loses
information
…withCompletion:0x%x]", self, arg1, (unsigned int)arg2); _logos_orig$_ung…
看提示应该是%log;打印第2个参数时,将void指针转换到unsigned int出现问题,这种情况下,我想是不是也可以通过您上面说的这种方式在makefile中增加CFLAGS来将这种类型的错误屏蔽掉。然后在makefile中填写:
THEOS_DEVICE_IP=192.168.0.151
ARCHS=arm64
TARGET=iphone:latest:8.0
include $(THEOS)/makefiles/common.mk
TWEAK_NAME = DockViewTweak
DockViewTweak_FILES = Tweak.xm
DockViewTweak_CFLAGS=-Wno-pointer-to-int-cast
include $(THEOS_MAKE_PATH)/tweak.mk
after-install::
install.exec “killall -9 SpringBoard”
make的时候还是提示同样的错误,请问是我CFLAGS写法不对吗,还是不能通过这种方式来屏蔽此种强制转换的错误的?
麻烦您能指教一下!谢谢!