打印

KeilC的头文件在HT-IDE中报错,该怎么解决?

[复制链接]
4546|12
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
jiyiche|  楼主 | 2009-4-10 00:48 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
我在HT-IDE里写C程序中包含了<string.h>,编译时出现错误提示如下:

伪指令progma的字符串`SAVE`无效
伪指令progma的字符串`REGPARMS`无效
伪指令progma的字符串`RESTORE`无效

这是为什么呢?如果在UV2里面编译就不会出错。我用HT的IDE为什么就不行?补充:HT-IDE是台湾HOLTEK公司的IDE,有自己的库,只是我要用KEIL C里的<string.h>头文件,应该怎么办。
STRING.H是从KEIL C文件夹中INC子文件夹里找到的,内容如下:
/*--------------------------------------------------------------------------
STRING.H

String functions.
Copyright (c) 1988-2002 Keil Elektronik GmbH and Keil Software, Inc.
All rights reserved.
--------------------------------------------------------------------------*/

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

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

#pragma SAVE
#pragma REGPARMS
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 *strstr  (char *s, char *sub);
extern char *strtok  (char *str, const 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);
#pragma RESTORE

相关帖子

沙发
computer00| | 2009-4-10 00:50 | 只看该作者

我晕……在另一个贴回复了呀,既然你用HT的库,

就应该用HT的头文件啊,对于库文件不能这样随便交叉引用的。

使用特权

评论回复
板凳
jiyiche|  楼主 | 2009-4-10 00:52 | 只看该作者

回复楼上的

谢谢。
只是想问问string.h对应的是HT当中的哪个头文件。

使用特权

评论回复
地板
computer00| | 2009-4-10 01:07 | 只看该作者

应该也是string.h,在他的INC目录下找找看。

使用特权

评论回复
5
jiyiche|  楼主 | 2009-4-10 01:12 | 只看该作者

它目录里没有这个头文件。

怎么办呢?

使用特权

评论回复
6
computer00| | 2009-4-10 01:22 | 只看该作者

没有那就是不支持这个咯……不过按理说应该有才对的。

可能是其它的名字吧?用strcat作为包含文字去在这个文件夹搜索下,看看有没有在哪个文件里了。

使用特权

评论回复
7
jiyiche|  楼主 | 2009-4-10 01:34 | 只看该作者

再请问一下圈圈

为什么不同的IDE里的头文件不能共用呢?我想不懂了,我把<string.h>拷贝到该IDE的INC文件夹里,为什么编译时候就会报错?
难道不同编译器的头文件不能混用?这样对C语言移植起来不就很不方便?

使用特权

评论回复
8
jiyiche|  楼主 | 2009-4-10 01:37 | 只看该作者

我找了,没在那个IDE的库文件夹中找到strcat

没找到,是不是意味着这个库里面不包含string.h这类的文件,那我要包含该用法,要怎么办呢?

使用特权

评论回复
9
computer00| | 2009-4-10 01:46 | 只看该作者

如果没有,那很有可能就是这个IDE不提供这些标准的库函数

那没办法,只有靠你自己去实现了。单.h文件只是一个函数格式的声明,实际的函数实现是放在对应的lib文件中的。
如果本身IDE不支持,你把.h文件复制进去也没用的。

这个是string好象是标准库,一般的C语言开发环境都支持才对啊,奇怪了。

搜索时指定是包含文字哦,不是文件名。

使用特权

评论回复
10
jiyiche|  楼主 | 2009-4-10 11:52 | 只看该作者

恩,我确定搜索时候是包含文字

找遍整个硬盘,就找到KEIL C中的string.h这个文件里有该关键字,其他的没有了。

使用特权

评论回复
11
holtek_fae| | 2009-4-10 15:26 | 只看该作者

string.h

holtek的IDE不包含,需要客户自己去实现.

使用特权

评论回复
12
jiyiche|  楼主 | 2009-4-10 19:59 | 只看该作者

谢谢楼上的

明白了

使用特权

评论回复
13
jiyiche|  楼主 | 2009-4-11 00:39 | 只看该作者

好的谢了

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

176

主题

484

帖子

0

粉丝