找回密码
 立即注册
查看: 85|回复: 9

stc32g屠龙刀开发板使用string,h问题

[复制链接]
  • TA的每日心情
    开心
    2024-5-29 09:10
  • 签到天数: 8 天

    [LV.3]偶尔看看II

    4

    主题

    27

    回帖

    186

    积分

    注册会员

    积分
    186
    发表于 2024-5-13 12:04:46 | 显示全部楼层 |阅读模式
    本帖最后由 大雨 于 2024-5-13 12:06 编辑

    stc32g屠龙刀开发板使用string,h问题

    一开始,在用strcmp函数时,编译警告不能正确链接string.h;就用笨方法添加strcmp函数解决。后大侠提示,重新安装KEILC251,修复string.h。最近,又用到strcat、strncat、strcpy 、strlen、memcmp ;编译警告都不能通过“string.h”正常使用。重新安装KEILC251后,进入安装目录,检查string.h正常。可是,在程序中,还是编译警告,找不到对应的“strcat、strncat、strcpy 、strlen、memcmp”;???这个是什么原因呢?


    截图202405131204173133.jpg
    回复 送花

    使用道具 举报

  • TA的每日心情
    开心
    4 小时前
  • 签到天数: 112 天

    [LV.6]常住居民II

    43

    主题

    1037

    回帖

    7143

    积分

    荣誉版主

    冲哥视频教程和各种开源资料QQ交流群884047237,可群

    积分
    7143
    QQ
    发表于 2024-5-13 15:24:26 | 显示全部楼层
    C251里这个函数库不全,建议手动在代码里添加下用到的字符串函数,百度都能都到C语言的函数原型的
    回复 支持 反对 送花

    使用道具 举报

  • TA的每日心情
    开心
    2024-5-29 09:10
  • 签到天数: 8 天

    [LV.3]偶尔看看II

    4

    主题

    27

    回帖

    186

    积分

    注册会员

    积分
    186
     楼主| 发表于 2024-5-13 15:52:04 | 显示全部楼层
    电子DIY小家 发表于 2024-5-13 15:24
    C251里这个函数库不全,建议手动在代码里添加下用到的字符串函数,百度都能都到C语言的函数原型的 ...

    就是C251的这个(string.h)头文件库不能用,对吗?

    点评

    没记错的话只是部分函数不能用  详情 回复 发表于 2024-5-14 08:13
    回复 支持 反对 送花

    使用道具 举报

  • TA的每日心情
    开心
    4 小时前
  • 签到天数: 112 天

    [LV.6]常住居民II

    43

    主题

    1037

    回帖

    7143

    积分

    荣誉版主

    冲哥视频教程和各种开源资料QQ交流群884047237,可群

    积分
    7143
    QQ
    发表于 2024-5-14 08:13:27 | 显示全部楼层
    大雨 发表于 2024-5-13 15:52
    就是C251的这个(string.h)头文件库不能用,对吗?

    没记错的话只是部分函数不能用
    回复 支持 反对 送花

    使用道具 举报

  • TA的每日心情
    开心
    2024-5-29 09:10
  • 签到天数: 8 天

    [LV.3]偶尔看看II

    4

    主题

    27

    回帖

    186

    积分

    注册会员

    积分
    186
     楼主| 发表于 2024-5-14 08:35:30 | 显示全部楼层
    电子DIY小家 发表于 2024-5-14 08:13
    没记错的话只是部分函数不能用

    谢谢!这个以后keil能完善吧
    回复 支持 反对 送花

    使用道具 举报

  • TA的每日心情
    慵懒
    2 小时前
  • 签到天数: 137 天

    [LV.7]常住居民III

    3

    主题

    223

    回帖

    676

    积分

    高级会员

    积分
    676
    发表于 2024-5-14 11:24:32 | 显示全部楼层
    奇怪,我测试了下都是好的啊,都能用,。
    回复 支持 反对 送花

    使用道具 举报

  • TA的每日心情
    开心
    2024-5-29 09:10
  • 签到天数: 8 天

    [LV.3]偶尔看看II

    4

    主题

    27

    回帖

    186

    积分

    注册会员

    积分
    186
     楼主| 发表于 2024-5-15 18:20:49 | 显示全部楼层
    Snapdragon 发表于 2024-5-14 11:24
    奇怪,我测试了下都是好的啊,都能用,。

    把你的string.h文件发一下
    回复 支持 反对 送花

    使用道具 举报

  • TA的每日心情
    慵懒
    5 小时前
  • 签到天数: 100 天

    [LV.6]常住居民II

    4

    主题

    546

    回帖

    1519

    积分

    金牌会员

    积分
    1519
    发表于 2024-5-16 09:26:38 | 显示全部楼层
    电子DIY小家 发表于 2024-5-13 15:24
    C251里这个函数库不全,建议手动在代码里添加下用到的字符串函数,百度都能都到C语言的函数原型的 ...

    这种情况不应该出现吧,如果是真的那keil厂家也太不认真了吧
    回复 支持 反对 送花

    使用道具 举报

  • TA的每日心情
    慵懒
    2 小时前
  • 签到天数: 137 天

    [LV.7]常住居民III

    3

    主题

    223

    回帖

    676

    积分

    高级会员

    积分
    676
    发表于 2024-5-16 09:30:23 | 显示全部楼层
    大雨 发表于 2024-5-15 18:20
    把你的string.h文件发一下

    /*--------------------------------------------------------------------------
    STRING.H

    String functions for C251 Version 4.
    Copyright (c) 1995-2007 Keil Elektronik GmbH and Keil Software, Inc.
    All rights reserved.
    --------------------------------------------------------------------------*/

    #pragma SAVE
    #pragma PARM251

    #ifndef _SIZE_T
    #define _SIZE_T
    typedef unsigned int size_t;
    #endif

    #ifndef NULL
    #define NULL ((void *) 0L)
    #endif

    #if (__C251__ >= 200)
    extern char *strcat (char *s1, const char *s2) reentrant;
    extern char *strncat (char *s1, const char *s2, size_t n) reentrant;

    extern char strcmp (const char *s1, const char *s2) reentrant;
    extern char strncmp (const char *s1, const char *s2, size_t n) reentrant;

    extern char *strcpy (char *s1, const char *s2) reentrant;
    extern char *strncpy (char *s1, const char *s2, size_t n) reentrant;

    extern size_t strlen (const char *) reentrant;

    extern char *strchr (const char *s, char c) reentrant;
    extern int strpos (const char *s, char c) reentrant;
    extern char *strrchr (const char *s, char c) reentrant;
    extern int strrpos (const char *s, char c) reentrant;

    extern size_t strspn (const char *s, const char *set) reentrant;
    extern size_t strcspn (const char *s, const char *set) reentrant;
    extern char *strpbrk (const char *s, const char *set) reentrant;
    extern char *strrpbrk (const char *s, const char *set) reentrant;

    extern char memcmp (const void *s1, const void *s2, size_t n) reentrant;
    extern void *memcpy (void *s1, const void *s2, size_t n) reentrant;
    extern void *memchr (const void *s, char val, size_t n) reentrant;
    extern void *memccpy (void *s1, const void *s2, char val, size_t n) reentrant;
    extern void *memmove (void *s1, const void *s2, size_t n) reentrant;
    extern void *memset  (void *s, char val, size_t n) reentrant;

    extern void far   *fmemset  (void far *s,   char val, unsigned int n) reentrant;
    extern void xdata *xmemset  (void xdata *s, char val, unsigned int n) reentrant;
    extern void far   *fmemcpy  (void far *s1,  void far *s2, unsigned int n) reentrant;
    extern void xdata *xmemcpy  (void xdata *s1, void xdata *s2, unsigned int n) reentrant;

    extern unsigned long hstrlen (const char huge *s)  reentrant;
    extern          char hstrcmp (const char huge *s1, const char huge *s2)  reentrant;
    extern    char huge *hstrcpy (char huge *s1, const char huge *s2)  reentrant;

    #pragma PARM4  // allow a maximum of 4 long as register parameters
    extern char huge *hstrncpy (char huge *s1, const char huge *s2, unsigned long n) reentrant;

    extern      char  hmemcmp (const void huge *s1, const void huge *s2, unsigned long len) reentrant;
    extern void huge *hmemcpy (void huge *s1, const void huge *s2, unsigned long len) reentrant;
    extern void huge *hmemchr (const void huge *ptr, char val, unsigned long len) reentrant;
    extern char huge *hmemccpy (char huge *dest, const char huge *src, char val, unsigned long len) reentrant;
    extern void huge *hmemmove (void huge *s1, const void huge *s2, unsigned long len) reentrant;
    extern void huge *hmemset (void huge *ptr, char val, unsigned long len) reentrant;

    #else
    extern char *strcat (char *s1, char *s2);
    extern char *strncat (char *s1, char *s2, int n);

    extern char strcmp (char *s1, char *s2);
    extern char strncmp (char *s1, char *s2, int n);

    extern char *strcpy (char *s1, char *s2);
    extern char *strncpy (char *s1, char *s2, int n);

    extern int strlen (char *);

    extern char *strchr (const char *s, char c);
    extern int strpos (const char *s, char c);
    extern char *strrchr (const char *s, char c);
    extern int strrpos (const char *s, char c);

    extern int strspn (char *s, char *set);
    extern int strcspn (char *s, char *set);
    extern char *strpbrk (char *s, char *set);
    extern char *strrpbrk (char *s, char *set);

    extern char memcmp (void *s1, void *s2, int n);
    extern void *memcpy (void *s1, void *s2, int n);
    extern void *memchr (void *s, char val, int n);
    extern void *memccpy (void *s1, void *s2, char val, int n);
    extern void *memmove (void *s1, void *s2, int n);
    extern void *memset  (void *s, char val, int n);

    #endif

    #pragma RESTORE
    回复 支持 反对 送花

    使用道具 举报

  • TA的每日心情
    开心
    2024-5-29 09:10
  • 签到天数: 8 天

    [LV.3]偶尔看看II

    4

    主题

    27

    回帖

    186

    积分

    注册会员

    积分
    186
     楼主| 发表于 2024-5-16 16:00:02 | 显示全部楼层
    Snapdragon 发表于 2024-5-16 09:30
    /*--------------------------------------------------------------------------
    STRING.H

    谢谢
    回复 支持 反对 送花

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    QQ|手机版|深圳国芯人工智能有限公司 ( 粤ICP备2022108929号-2 )

    GMT+8, 2024-6-11 12:38 , Processed in 0.071405 second(s), 69 queries .

    Powered by Discuz! X3.5

    © 2001-2024 Discuz! Team.

    快速回复 返回顶部 返回列表