Fedora和conio.h不得不说的故事(fedora缺少conio.h最强解决方案)
来源:互联网 发布:java 程序员招聘 编辑:程序博客网 时间:2024/06/05 20:00
最近在研究一款二进制代码分析工具,于是找了一堆c程序来分析,结果发现在linux下编译的时候都说没有conio.h这个库。差了下发现好像现在的Fedora都不自带conio.h了。
什么是conio.h库呢?
conio.h不是C标准库中的头文件,在C standard library,ISO C 和POSIX标准中均没有定义。
conio是Console Input/Output(控制台输入输出)的简写,其中定义了通过控制台进行数据输入和数据输出的函数,主要是一些用户通过按键盘产生的对应操作,比如getch()函数等等。
包含的库函数有:
cgets(char *);
cprintf(const char *, ...);
cputs(const char *);
cscanf(const char *, ...);
inp(unsigned short);
inpw(unsigned short);
getch(void);
getche(void);
kbhit(void);
outp(unsigned short, int);
outpw(unsigned short, unsigned short);
putch(int);
ungetch(int);
void _Cdecl clreol (void);
void _Cdecl clrscr (void);
void _Cdecl delline (void);
int _Cdecl gettext (int left, int top, int right, int bottom, void *destin);
void _Cdecl gettextinfo (struct text_info *r);
void _Cdecl gotoxy (int x, int y);
void _Cdecl highvideo (void);
void _Cdecl insline (void);
void _Cdecl lowvideo (void);
int _Cdecl movetext (int left, int top, int right, int bottom, int destleft, int desttop);
void _Cdecl normvideo (void);
int _Cdecl puttext (int left, int top, int right, int bottom, void *source);
void _Cdecl textattr (int newattr);
void _Cdecl textbackground (int newcolor);
void _Cdecl textcolor (int newcolor);
void _Cdecl textmode (int newmode);
int _Cdecl wherex (void);
int _Cdecl wherey (void);
void _Cdecl window (int left, int top, int right, int bottom);
char * _Cdecl cgets (char *str);
int _Cdecl cprintf (const char *format, ...);
int _Cdecl cputs (const char *str);
int _Cdecl cscanf (const char *format, ...);
int _Cdecl getch (void);
int _Cdecl getche (void);
char * _Cdecl getpass (const char *prompt);
int _Cdecl kbhit (void);
int _Cdecl putch (int c);
int _Cdecl ungetch (int ch);
cprintf(const char *, ...);
cputs(const char *);
cscanf(const char *, ...);
inp(unsigned short);
inpw(unsigned short);
getch(void);
getche(void);
kbhit(void);
outp(unsigned short, int);
outpw(unsigned short, unsigned short);
putch(int);
ungetch(int);
void _Cdecl clreol (void);
void _Cdecl clrscr (void);
void _Cdecl delline (void);
int _Cdecl gettext (int left, int top, int right, int bottom, void *destin);
void _Cdecl gettextinfo (struct text_info *r);
void _Cdecl gotoxy (int x, int y);
void _Cdecl highvideo (void);
void _Cdecl insline (void);
void _Cdecl lowvideo (void);
int _Cdecl movetext (int left, int top, int right, int bottom, int destleft, int desttop);
void _Cdecl normvideo (void);
int _Cdecl puttext (int left, int top, int right, int bottom, void *source);
void _Cdecl textattr (int newattr);
void _Cdecl textbackground (int newcolor);
void _Cdecl textcolor (int newcolor);
void _Cdecl textmode (int newmode);
int _Cdecl wherex (void);
int _Cdecl wherey (void);
void _Cdecl window (int left, int top, int right, int bottom);
char * _Cdecl cgets (char *str);
int _Cdecl cprintf (const char *format, ...);
int _Cdecl cputs (const char *str);
int _Cdecl cscanf (const char *format, ...);
int _Cdecl getch (void);
int _Cdecl getche (void);
char * _Cdecl getpass (const char *prompt);
int _Cdecl kbhit (void);
int _Cdecl putch (int c);
int _Cdecl ungetch (int ch);
言归正传,没有conio库的话我们就自己下一个呗。于是洒家到中国源码网搞了一个conio.h的代码,扶到程序目录下,再把需要编译的程序中的include<conio.h>改成include"conio.h",因为前者的意思是编译器只在系统库中寻找conio,而后者先在程序的目录下的库中查找,再去系统库中查找。
好像问题可以顺利解决了,但是,我试着再编译了程序发现,编译器不报没有conio的错了,却说miss了另外一个库。。。仔细查看我下载的conio源码,发现其中也include了一些其他的库。。。
有大神告诉我,如果Fedora下缺少conio,可以安装一个kernel-devel开发包就解决了,yum install kernel-devel,yum install ncurses-devel.i686,不过因为我还在下载kernel安装包的时候已经用后面的方法解决了,所以这个方法的正确性就没能证实。
网上有些论坛说可以用curses库来代替conio库,我试了下好像不行,不过我不确定我的操作有没有问题。有兴趣的人可以去试试。
最后我决定干脆直接给系统库中装一个conio好了。http://download.csdn.net/detail/tianshuai11/4318201 这里有conio的源代码。下载下来以后,解压,进入解压出的目录,./configure 再 make 再 make install 就行啦,看看你的/usr/include 目录下是不是多了conio.h 问价啦?再编译一下引用了conio系统库的源代码,啊,还是不对!!!???
原来,因为这个是静态库,编译的时候还需要在编译的语句加上-lconio 参数即可。
终于成功了。
4 0
- Fedora和conio.h不得不说的故事(fedora缺少conio.h最强解决方案)
- conio.h
- conio.h
- conio.h
- conio.h
- conio.h
- conio.h
- conio.h
- conio.h/stdlib.h
- conio.h头文件
- #include<conio.h>
- 有关头文件conio.h
- c语言 conio.h头文件介绍
- 【C语言】conio.h 函数详解
- Ubuntu使用Windows下的conio.h
- linux中无 conio.h的解决办法
- Linux 下没有conio.h 已解决
- c语言 conio.h头文件介绍
- 郑大大一新生给我感觉
- poj刷题存档(1)
- linux内核学习——内存管理
- 液晶\串行\1602串口 (4bit)通讯
- Linux操作系统下的多线程编程详细解析----条件变量pthread_cond_t那些事儿
- Fedora和conio.h不得不说的故事(fedora缺少conio.h最强解决方案)
- addSubView的一点讨论
- #import和@class在oc中的区别。
- 将.dll文件转化为.lib文件,并查看.lib中的函数
- WSAIoctl()
- vs2010编写C和解决窗口一闪而过的方法
- C++类的继承
- wrod中的公式字体
- 关于target...action中的一点体会