delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2003/11/06/15:57:02

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
Message-ID: <20031106202855.25855.qmail@web13001.mail.yahoo.com>
Date: Thu, 6 Nov 2003 12:28:55 -0800 (PST)
From: Thomas Tutone <thomas8675309 AT yahoo DOT com>
Subject: Re: linker error: undefined reference to: '___gxx_personality_v0'
To: djgpp AT delorie DOT com
MIME-Version: 1.0

Bart de Keijzer wrote:

> Hello,
>
> I have a problem when I try to compile a C-program, 
>it gives me
> the following error:
> ----------------
> c:/djgpp/tmp/ccP9aOYb.o(.eh_frame+0x11):nio1.C: 
> undefined

As someone else pointed out, note that your filename
apparently has a CAPITAL C as an extension, not a
lowercase c.  That means that gcc's default behavior
is to compile the program as a C++ program.  If you
change that to a lowercase c, the program will be
compiled as a C program, as you apparently intend.

> reference to `___gxx_personality_v0'
> collect2: ld returned 1 exit status
> ----------------

This is a linker error.  It generally means you have
compiled a C++ program but neglected to link in the
C++ library.  If you compile using gxx instead, the
library is automatically linked in for you, which is
why you didn't get the error.

> This is the program I want to compile:
>
> ----------------
> #include <stdio.h>
> #include <string.h>
> #include <stdlib.h>
>
> int alfa(const void *e1, const void *e2)
> {
> return (*(char *)e1-*(char *)e2);
> }
>
> typedef struct
> {
> char woord[10];
> bool flag[9];

> Here is the problem. AFAIK there are not 
> type 'bool' in C.

Not true.  bool is part of C99, and is defined in
<stdbool.h>  If the OP wants to use bool in a C
program, he should make sure to #include <stdbool.h>

So, to summarize, to make your program work, do two
things:

1.  add the #include directive indicated above
2.  change the filename from nio1.C to nio1.c.

And when you compile, make sure you specify the
filename with the lowercase c extension.

If you do all that, it should compile fine.

Best regards,

Tom


















__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019