How do I use strcasestr()?

前端 未结 2 1308
终归单人心
终归单人心 2021-02-12 23:04

I #include but when I call strcasestr(src, search); I get the following error message implicit declaration of function ‘strcases

2条回答
  •  天涯浪人
    2021-02-12 23:33

    As specified in the corresponding manpage, since strcasestr is a nonstandard extension you must #define _GNU_SOURCE before the #include before any #include (other files may already include , thanks @Cubbi for pointing out this potential problem); this can also easily be accomplished by specifying -D_GNU_SOURCE on the compiler command line.

提交回复
热议问题