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

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: B_A_R_T_K AT hotmail DOT com (Bart de Keijzer)
Newsgroups: comp.os.msdos.djgpp
Subject: linker error: undefined reference to: '___gxx_personality_v0'
Date: 6 Nov 2003 08:01:56 -0800
Organization: http://groups.google.com
Lines: 95
Message-ID: <9b9ba90f.0311060801.4993f466@posting.google.com>
NNTP-Posting-Host: 62.166.57.51
X-Trace: posting.google.com 1068134516 23794 127.0.0.1 (6 Nov 2003 16:01:56 GMT)
X-Complaints-To: groups-abuse AT google DOT com
NNTP-Posting-Date: Thu, 6 Nov 2003 16:01:56 +0000 (UTC)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

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 reference to
`___gxx_personality_v0'
collect2: ld returned 1 exit status
----------------

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];
} negen_t;

int main()
{
	int i, j, k, rec=9, cur=9; 
	FILE *fin, *fuit, *fdat;
	negen_t data, recwoord;
	char negen[10], rest[10], *restp=rest;
	
	fuit=fopen("negen.uit","w");
	fin=fopen("negen.in","r");
	fdat=fopen("negen.dat","r");
	fscanf(fin, "%s", negen);
	
	for(i=0; i<13367; i++, cur=9)
	{
		fscanf(fdat,"%s\n", data.woord);
		for (j=0;j<9;j++) data.flag[j]=0;
		for (j=0;j<9;j++)
		{
			if (cur-(9-j)>rec) break;
			for (k=0;k<9;k++)
			{
				if (negen[j]==data.woord[k] && data.flag[k]==0)
					{
						data.flag[k]=1;
						cur--;
						break;
					}
			}
		}
		if (cur<rec) 
		{
			rec=cur;
			strcpy(recwoord.woord, data.woord);
			for (j=0;j<9;j++) recwoord.flag[j]=data.flag[j];
		}
	}
	for (i=0;i<9;i++) rest[i]=0;
	for (i=0;i<9;i++)
		if (recwoord.flag[i]==0) {*restp=recwoord.woord[i]; restp++;}
		
	qsort(&rest, rec, 1, alfa); //error because of this line
	
	fprintf(fuit, "%s\n%d\n%s\n", recwoord.woord, rec, rest);
	
	fclose(fuit);
	fclose(fin);
	fclose(fdat);
	return (0);
}
----------------

I try to compile it using this command line:

gcc -Wall nio1.c

If I remove the qsort function from the source, and then compile it,
everything works fine.
I don't know why I get this error.
Another strange thing: If I compile it using gxx instead of gcc, it
just works.
But I want to compile it using gcc, because this is a program written
for a contest (Olympiad in Informatics) and that contest requires me
to compile it using gcc and not gxx.
Does anyone know what I am doing wrong?

Thanks!
Bart de Keijzer

- Raw text -


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