未声明ncursesw函数 [英] ncursesw functions not declared

查看:102
本文介绍了未声明ncursesw函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在支持Unicode的情况下使用ncurses,因此我在.c文件中加入了以下行.

I need to use ncurses with unicode support, so I included the following line to my .c file.

#include< curses.h>

在我的makefile文件中,我使用-lncursesw作为标志.当调用类似get_wch()的函数时,它告诉我函数的隐式声明".我在Arch Linux上,所以我用pacman -S ncurses安装了ncurses.在/usr/include中,我可以找到cursesw.h,但是它没有像get_wch()这样的函数.在/lib下,我可以找到libcursesw.so,这是怎么回事?

In my makefile I'm using -lncursesw as a flag. When calling functions like get_wch(), it tells me "implicit declaration of function". I'm on Arch Linux so I installed ncurses with pacman -S ncurses. In /usr/include I can find cursesw.h, but it doesn't have functions like get_wch() declared. Under /lib I can find libcursesw.so, so what's the matter?

推荐答案

使用< curses.h> ,读取头文件以查看您希望使用的定义:

Use <curses.h>, read the header file to see which definition you prefer using:

/* 
 * With XPG4, you must define _XOPEN_SOURCE_EXTENDED, it is redundant (or 
 * conflicting) when _XOPEN_SOURCE is 500 or greater.  If NCURSES_WIDECHAR is   
 * not already defined, e.g., if the platform relies upon nonstandard feature   
 * test macros, define it at this point if the standard feature test macros 
 * indicate that it should be defined. 
 */
#ifndef NCURSES_WIDECHAR
#if defined(_XOPEN_SOURCE_EXTENDED) || (defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE - 0 >= 500))
#define NCURSES_WIDECHAR 1
#else  
#define NCURSES_WIDECHAR 0
#endif
#endif /* NCURSES_WIDECHAR */

(只需 NCURSES_WIDECHAR 就足够了).手册页中对此进行了概述.

(just NCURSES_WIDECHAR should be enough). This is summarized in the manual page.

如果阅读 cursesw.h ,您可能会注意到它是用于C ++绑定的.

If you read cursesw.h, you might notice that it is for the C++ binding.

这篇关于未声明ncursesw函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆