[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.c

wchar_t in Linux

Dave \Crash\ Dummy

5/6/2011 12:17:00 AM

Hello,

which lib must I add for wchar_t?

cc -o nim nim.c -lcurses
/tmp/ccD8wZTE.o: In function `SetHolz':
nim.c:(.text+0x23b): undefined reference to `addwstr'
nim.c:(.text+0x24a): undefined reference to `addwstr'
collect2: ld gab 1 als Ende-Status zurück
make: *** [nim] Fehler 1

kind regards
Heiner

43 Answers

Ian Collins

5/6/2011 12:35:00 AM

0

On 05/ 6/11 12:17 PM, Heinrich Wolf wrote:
> Hello,
>
> which lib must I add for wchar_t?
>
> cc -o nim nim.c -lcurses
> /tmp/ccD8wZTE.o: In function `SetHolz':
> nim.c:(.text+0x23b): undefined reference to `addwstr'

That's a curses function, man is your friend.

--
Ian Collins

Dave \Crash\ Dummy

5/6/2011 1:12:00 AM

0


"Ian Collins" <ian-news@hotmail.com> schrieb im Newsbeitrag
news:92gu0nFv9pU4@mid.individual.net...
....
>> cc -o nim nim.c -lcurses
>> /tmp/ccD8wZTE.o: In function `SetHolz':
>> nim.c:(.text+0x23b): undefined reference to `addwstr'
>
> That's a curses function, man is your friend.

Hello Ian,

I already read google and man pages. But I did not yet find out. Did you see
that I already have -lcurses in my make statement?

Heiner

Ian Collins

5/6/2011 1:17:00 AM

0

On 05/ 6/11 01:11 PM, Heinrich Wolf wrote:
>
> "Ian Collins"<ian-news@hotmail.com> schrieb im Newsbeitrag
> news:92gu0nFv9pU4@mid.individual.net...
> ....
>>> cc -o nim nim.c -lcurses
>>> /tmp/ccD8wZTE.o: In function `SetHolz':
>>> nim.c:(.text+0x23b): undefined reference to `addwstr'
>>
>> That's a curses function, man is your friend.
>
> Hello Ian,
>
> I already read google and man pages. But I did not yet find out. Did you see
> that I already have -lcurses in my make statement?

Did you include curses.h?

If you did, I suggest you take the question to a Linux group.

--
Ian Collins

William Ahern

5/6/2011 2:27:00 AM

0

Ian Collins <ian-news@hotmail.com> wrote:
> On 05/ 6/11 01:11 PM, Heinrich Wolf wrote:
> >
> > "Ian Collins"<ian-news@hotmail.com> schrieb im Newsbeitrag
> > news:92gu0nFv9pU4@mid.individual.net...
> > ....
> >>> cc -o nim nim.c -lcurses
> >>> /tmp/ccD8wZTE.o: In function `SetHolz':
> >>> nim.c:(.text+0x23b): undefined reference to `addwstr'
> >>
> >> That's a curses function, man is your friend.
> >
> > Hello Ian,
> >
> > I already read google and man pages. But I did not yet find out. Did you see
> > that I already have -lcurses in my make statement?

> Did you include curses.h?

I did and I got the same error. `grep -r addwstr /usr/include` doesn't find
the string on either OpenBSD or Linux. On OS X I need to define
_XOPEN_SOURCE_EXTENDED, even though a cursory investigation of the XCURSES
standard suggests _XOPEN_SOURCE should be sufficient, although I've never
done any curses work.

> If you did, I suggest you take the question to a Linux group.

Or the GNU ncurses mailing list. It may not be implemented.

Dave \Crash\ Dummy

5/6/2011 2:36:00 AM

0


"William Ahern" <william@wilbur.25thandClement.com> schrieb im Newsbeitrag
news:cs2c98-a0n.ln1@wilbur.25thandClement.com...
> Ian Collins <ian-news@hotmail.com> wrote:
....
>> Did you include curses.h?

Of course I did.

> I did and I got the same error. `grep -r addwstr /usr/include` doesn't
> find
> the string on either OpenBSD or Linux.

The compiler did not complain about addwstr. Only the linker did.

> On OS X I need to define
> _XOPEN_SOURCE_EXTENDED, even though a cursory investigation of the XCURSES
> standard suggests _XOPEN_SOURCE should be sufficient, although I've never
> done any curses work.
>
>> If you did, I suggest you take the question to a Linux group.
>
> Or the GNU ncurses mailing list. It may not be implemented.

William Ahern

5/6/2011 3:41:00 AM

0

Heinrich Wolf <invalid@invalid.invalid> wrote:

> "William Ahern" <william@wilbur.25thandClement.com> schrieb im Newsbeitrag
> news:cs2c98-a0n.ln1@wilbur.25thandClement.com...
> > Ian Collins <ian-news@hotmail.com> wrote:
> ...
> >> Did you include curses.h?

> Of course I did.

> > I did and I got the same error. `grep -r addwstr /usr/include` doesn't
> > find
> > the string on either OpenBSD or Linux.

> The compiler did not complain about addwstr. Only the linker did.

And that may suggest a linking issue. Or it may not. There could be a
declaration but no definition. In fact, using Google Codesearch I find
ncurses header files with addwstr declarations and the comment "missing".

In any event, this problem would better addressed in a different forum with
an audience more familiar with curses programming. Try comp.unix.programmer,
a Linux specific forum, or IMO GNU ncurses mailing list, presuming you're
using GNU ncurses.

Martin Ambuhl

5/6/2011 4:18:00 AM

0

On 5/5/2011 8:17 PM, Heinrich Wolf wrote:
> Hello,
>
> which lib must I add for wchar_t?

It is normally not a library you need to add, but a header
#include <wchar.h>

It may be sometimes useful to also
#include <wctype.h>

Your implementation may fall short of supplying full support for
wchar_t. Your error messages suggest another problem

> cc -o nim nim.c -lcurses
> /tmp/ccD8wZTE.o: In function `SetHolz':
> nim.c:(.text+0x23b): undefined reference to `addwstr'
> nim.c:(.text+0x24a): undefined reference to `addwstr'
> collect2: ld gab 1 als Ende-Status zurück
> make: *** [nim] Fehler 1

It is conceivable that I missed the addition of "addwstr" to the
standard C libraries, but I doubt it. My guess is that whatever package
you got "nim.c" from included files containing this almost certainly
non-standard function and you forgot to link it (possibly even to
compile it).

Dave \Crash\ Dummy

5/6/2011 4:35:00 AM

0


"Martin Ambuhl" <mambuhl@earthlink.net> schrieb im Newsbeitrag
news:ipvsq3$tpe$1@dont-email.me...
....
> It is normally not a library you need to add, but a header
> #include <wchar.h>
....
It's already in nim.c

Harald van D?k

5/6/2011 6:30:00 AM

0

On May 6, 2:17 am, Heinrich Wolf wrote:
> Hello,
>
> which lib must I add for wchar_t?
>
> cc -o nim nim.c -lcurses
> /tmp/ccD8wZTE.o: In function `SetHolz':
> nim.c:(.text+0x23b): undefined reference to `addwstr'
> nim.c:(.text+0x24a): undefined reference to `addwstr'
> collect2: ld gab 1 als Ende-Status zurück
> make: *** [nim] Fehler 1

On May 6, 4:36 am, Heinrich Wolf wrote:
> The compiler did not complain about addwstr. Only the linker did.

Looking at how you're invoking the compiler, you're not asking it to
tell you when anything is wrong. Unfortunately, for several compilers,
including gcc which you are probably using, no warning is emitted by
default for implicit function declarations. First, try enabling
warnings. If you still get no warning for the implicit function
declaration, then you're using the header files for the wide-char-
aware version of ncurses, but linking with the non-wide-char-aware
version (which suggests the problem is with your (distro's) setup).
But if you do get a warning after that, then it's just because you
aren't using the wide-char-aware version of ncurses. How to install
and use that depends on exactly what system you're running. It may be
available as a replacement for the lib(n)curses you have installed
now, or it may install its header files and library using another name.

Dave \Crash\ Dummy

5/6/2011 8:32:00 AM

0


"Harald van D?k" <truedfx@gmail.com> schrieb im Newsbeitrag
news:3488665a-7cfc-4c35-a447-ce4d6ed5af54@w10g2000yqa.googlegroups.com...

Looking at how you're invoking the compiler, you're not asking it to
tell you when anything is wrong. Unfortunately, for several compilers,
including gcc which you are probably using, no warning is emitted by
default for implicit function declarations. First, try enabling
warnings. If you still get no warning for the implicit function
declaration, then you're using the header files for the wide-char-
aware version of ncurses, but linking with the non-wide-char-aware
version (which suggests the problem is with your (distro's) setup).

<Heiner>
Which include is for the wide-char-aware version of ncurses?
I have #include <curses.h> and I also tried #include <ncurses.h>
Which lib is for the wide-char-aware version of ncurses?
I have -lcurses and I also tried -lncurses .
</Heiner>

But if you do get a warning after that, then it's just because you
aren't using the wide-char-aware version of ncurses. How to install
and use that depends on exactly what system you're running. It may be
available as a replacement for the lib(n)curses you have installed
now, or it may install its header files and library using another name.

<Heiner>
I use Fedora 14
</Heiner>

kind regards
Heiner