博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
函数隐式声明警告如何解决_如何解决C语言中的隐式声明库函数警告
阅读量:2507 次
发布时间:2019-05-11

本文共 1055 字,大约阅读时间需要 3 分钟。

函数隐式声明警告如何解决

When compiling a program you might find that the compiler gives you a warning similar to

编译程序时,您可能会发现编译器向您发出类似于以下内容的警告

hello.c:6:3: warning: implicitly declaring library function      'printf' with type 'int (const char *, ...)'      [-Wimplicit-function-declaration]  printf("Name length: %u", length);  ^

or

要么

hello.c:5:16: warning: implicitly declaring library function      'strlen' with type 'unsigned long (const char *)'      [-Wimplicit-function-declaration]  int length = strlen(name);               ^

This problem occurs because you used a function from the standard library without first including the appropriate header file.

发生此问题的原因是您使用了标准库中的函数而没有首先包含相应的头文件。

The compiler will also give you a suggestion, like the following one:

编译器还会给您一个建议,如下所示:

hello.c:5:16: note: include the header 
or explicitly provide a declaration for 'strlen'

which points you in the right direction.

指出正确的方向。

In this case, adding

在这种情况下,添加

#include 

at the top of the C file will solve the issue.

C文件的顶部将解决此问题。

翻译自:

函数隐式声明警告如何解决

转载地址:http://mtmgb.baihongyu.com/

你可能感兴趣的文章
centos 创建以日期为名的文件夹
查看>>
Java Timer触发定时器
查看>>
Page Object设计模式
查看>>
程序的基础知识
查看>>
在VIM中使用GDB调试 – 使用vimgdb
查看>>
python爬虫---从零开始(五)pyQuery库
查看>>
POJ2236(KB5-A)
查看>>
Centos MySQL数据库迁移详细步骤
查看>>
2初出茅庐--初级篇2.1
查看>>
新建 WinCE7.0 下的 Silverlight 工程
查看>>
腾讯的张小龙是一个怎样的人?
查看>>
jxl写入excel实现数据导出功能
查看>>
linux文件目录类命令|--cp指令
查看>>
.net MVC 404错误解决方法
查看>>
linux系统目录结构
查看>>
git
查看>>
btn按钮之间事件相互调用
查看>>
Entity Framework 4.3.1 级联删除
查看>>
codevs 1163:访问艺术馆
查看>>
冲刺Noip2017模拟赛3 解题报告——五十岚芒果酱
查看>>