warning: function declaration isn't a prototype原因分析
2011-07-18 09:09
507 查看
warning: function declaration isn't a prototype
出现此警告原因:
1: 函数没有声明。在你调用的这个函数前面加上该函数的定义即可。
main()
{
test();
}
test (int a)
{
printf("test: %d\n", a);
}
这个代码中如果在main函数前面加上“test (int a);”就可以正确运行了
2:
#include
#include
#include
#include
static int hello_init_module(void)
{
printk("Hello, world - this is the kernel speaking\n");
return 0;
}
/* Cleanup - undid whatever init_module did */
static void hello_cleanup_module(void)
{
printk("Short is the life of a kernel module\n");
}
module_init(hello_init_module);
module_exit(hello_cleanup_module);
上面代码是内核中的一个模块, 如果 static int hello_init_module(void) 括号里面没有加void就会出现此警告。
出现此警告原因:
1: 函数没有声明。在你调用的这个函数前面加上该函数的定义即可。
main()
{
test();
}
test (int a)
{
printf("test: %d\n", a);
}
这个代码中如果在main函数前面加上“test (int a);”就可以正确运行了
2:
#include
#include
#include
#include
static int hello_init_module(void)
{
printk("Hello, world - this is the kernel speaking\n");
return 0;
}
/* Cleanup - undid whatever init_module did */
static void hello_cleanup_module(void)
{
printk("Short is the life of a kernel module\n");
}
module_init(hello_init_module);
module_exit(hello_cleanup_module);
上面代码是内核中的一个模块, 如果 static int hello_init_module(void) 括号里面没有加void就会出现此警告。
相关文章推荐
- warning: function declaration isn't a prototype
- 编译LED驱动时,提示: warning: function declaration isn't a prototype
- function declaration isn't a prototype 是什么原因
- warning: function declaration isn't a prototype 解决方法
- linux驱动中出错function declaration isn't a prototype
- function declaration isn't a prototype解决办法
- 解决: 编译警告 : “warning: function declaration isn't a prototype ”
- function declaration isn't a prototype 如何解决
- warning: function declaration isn't a prototype
- warning: function declaration isn’t a prototype解决方法
- warning: function declaration isn’t a prototype(函数声明不是原型)的解决办法
- warning: function declaration isn’t a prototype(函数声明不是原型)
- 如何解决warning:implicit declaration of function 'xxx'
- warning: function declaration isn’t a prototype(函数声明不是原型)的解决办法
- Linux 编程 出现警告warning: implicit declaration of function 'pread'('pwrite')
- gcc下编译出现warning:implicit declaration of function 'strdup'和warning:implicit declaration of function 'gethostname'
- implicit declaration of function '...' 的warning
- warning: function declaration isn’t a prototype(函数声明不是原型)的解决办法
- warning: function declaration isn't a prototype
- warning: function declaration isn't a prototype