stc32g屠龙刀开发板使用string,h问题
本帖最后由 大雨 于 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”;???这个是什么原因呢?
C251里这个函数库不全,建议手动在代码里添加下用到的字符串函数,百度都能都到C语言的函数原型的 电子DIY小家 发表于 2024-5-13 15:24
C251里这个函数库不全,建议手动在代码里添加下用到的字符串函数,百度都能都到C语言的函数原型的 ...
就是C251的这个(string.h)头文件库不能用,对吗? 大雨 发表于 2024-5-13 15:52
就是C251的这个(string.h)头文件库不能用,对吗?
没记错的话只是部分函数不能用
电子DIY小家 发表于 2024-5-14 08:13
没记错的话只是部分函数不能用
谢谢!这个以后keil能完善吧 奇怪,我测试了下都是好的啊,都能用,。 Snapdragon 发表于 2024-5-14 11:24
奇怪,我测试了下都是好的啊,都能用,。
把你的string.h文件发一下 电子DIY小家 发表于 2024-5-13 15:24
C251里这个函数库不全,建议手动在代码里添加下用到的字符串函数,百度都能都到C语言的函数原型的 ...
这种情况不应该出现吧,如果是真的那keil厂家也太不认真了吧 大雨 发表于 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 charhmemcmp (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
Snapdragon 发表于 2024-5-16 09:30
/*--------------------------------------------------------------------------
STRING.H
谢谢
{:handshake:}
页:
[1]