”No previous prototype for function “warning警告错误

在编译《iphone开发秘籍》第八章的秘诀一的代码时碰到以下警告错误:

CGPoint randomPoint()
{
    int half = 32;
    int freesize = 240 - 2 * half;
    return CGPointMake(random() % freesize + half, random() % freesize + half);
}

warning:No previous prototype for function "randomPoint"。如何取消这个警告错误呢?方法尝试了这两种都可以:

1.方法上加修饰符static

2.或者Project-Info -> TARGETS ->Build Settings -> LLVM GCC4.2 - Warnings组 -> Missing Function Prototypes   Yes->No


Build started: Project: project *** Using Compiler 'V6.16', folder: 'D:\kile-v5\ARM\ARMCLANG\Bin' Build target 'Target 1' Start/core_cm3.c(445): error: non-ASM statement in naked function is not supported uint32_t result=0; ^ Start/core_cm3.c(442): note: attribute is here uint32_t __get_PSP(void) __attribute__( ( naked ) ); ^ Start/core_cm3.c(465): error: parameter references not allowed in naked functions "BX lr \n\t" : : "r" (topOfProcStack) ); ^ Start/core_cm3.c(461): note: attribute is here void __set_PSP(uint32_t topOfProcStack) __attribute__( ( naked ) ); ^ Start/core_cm3.c(479): error: non-ASM statement in naked function is not supported uint32_t result=0; ^ Start/core_cm3.c(476): note: attribute is here uint32_t __get_MSP(void) __attribute__( ( naked ) ); ^ Start/core_cm3.c(499): error: parameter references not allowed in naked functions "BX lr \n\t" : : "r" (topOfMainStack) ); ^ Start/core_cm3.c(495): note: attribute is here void __set_MSP(uint32_t topOfMainStack) __attribute__( ( naked ) ); ^ Start/core_cm3.c(509): warning: no previous prototype for function '__get_BASEPRI' [-Wmissing-prototypes] uint32_t __get_BASEPRI(void) ^ Start/core_cm3.c(509): note: declare 'static' if the function is not intended to be used outside of this translation unit uint32_t __get_BASEPRI(void) ^ static Start/core_cm3.c(524): warning: no previous prototype for function '__set_BASEPRI' [-Wmissing-prototypes] void __set_BASEPRI(uint32_t value) ^ Start/core_cm3.c(524): note: declare 'static' if the function is not intended to be used outside of this translation unit void __set_BASEPRI(uint32_t value) ^ static Start/core_cm3.c(5
最新发布
06-28
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值