一个关于GTK和C的编译警告,有人能给个解释么

0 views
Skip to first unread message

Athurg Gooth

unread,
Nov 21, 2009, 7:34:22 AM11/21/09
to go...@googlegroups.com
源代码截取如下:

int length;
lenght = strlen(gtk_entry_get_text(GTK_ENTRY(entry_result)));

编译消息中由如下警告:
警告:隐式声明与内建函数‘strlen’不兼容
我看了下,gtk_entry_get_text返回的是const char *类型的,和strlen的参数是一样的类型的啊?

邱焜

unread,
Dec 13, 2009, 2:15:07 AM12/13/09
to go...@googlegroups.com
据说,加上 #include <stdlib.h>

2009/11/21 Athurg Gooth <ath...@gooth.cn>



--
天将降大任于鄙人也。


魏藥/Medical-Wei

unread,
Dec 13, 2009, 3:21:31 AM12/13/09
to gooth
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

我自己實驗的結果是
增加
#include

2009/12/13 邱焜 :
> 据说,加上 #include
>
> 2009/11/21 Athurg Gooth


>>
>> 源代码截取如下:
>>>
>>> int length;
>>>
>>> lenght = strlen(gtk_entry_get_text(GTK_ENTRY(entry_result)));
>>
>> 编译消息中由如下警告:
>>>
>>> 警告:隐式声明与内建函数‘strlen’不兼容
>>
>> 我看了下,gtk_entry_get_text返回的是const char *类型的,和strlen的参数是一样的类型的啊?
>
>
> --
> 天将降大任于鄙人也。
>
>
>

- --
Medical-Wei/魏藥

- ----
Please avoid sending me Word or PowerPoint attachments.
See: http://www.gnu.org/philosophy/no-word-attachments.html
請儘可能不要寄給我 Microsoft Word 或是 PowerPoint 的附件,我會打不開。
參照:http://blog.ofset.org/ckhung/index.php?post/081-nodocx


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Use GnuPG with Firefox : http://getfiregpg.org (Version: 0.7.10)

iEYEARECAAYFAkskpBQACgkQHN3lx2LM9DTjywCeO1EBBwbB9x7DR2OytSctJAS+
9oUAnAhpMT9MhGgk5WKt38Y5hmlfZin5
=Hu82
-----END PGP SIGNATURE-----

Vabc3

unread,
Dec 15, 2009, 1:41:34 AM12/15/09
to Gooth Linux
---
gcc4.4 does not by default #include stdio.h, or stdlib.h, no
header files are by default included, all header files of
standard c/c++ libraries need to be explicitly included.
---

Athurg Gooth

unread,
Dec 17, 2009, 7:31:54 AM12/17/09
to go...@googlegroups.com
嗯,明白了

2009/12/15 Vabc3 <vab...@gmail.com>
Reply all
Reply to author
Forward
0 new messages