[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: question and bug report for gprolog 1.2.14
From: |
Roberto Bagnara |
Subject: |
Re: question and bug report for gprolog 1.2.14 |
Date: |
Tue, 10 Sep 2002 22:17:39 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1) Gecko/20020827 |
Erick Alphonse wrote:
Actually, the problem is getting serious for me because I tried to
compile the program below with "gplc --c-compiler g++ -L '-lstdc++'
test.pl pred1.cpp pred2.cpp" under gprolog 1.2.14, 1.2.13, 1.2.12, and I
get :
/tmp/gplckYaoec.o(.bss+0x0): multiple definition of `last_read_line'
/tmp/gplcXiDz6a.o(.bss+0x0): first defined here
/tmp/gplckYaoec.o(.bss+0x4): multiple definition of `last_read_col'
/tmp/gplcXiDz6a.o(.bss+0x4): first defined here
/tmp/gplckYaoec.o(.bss+0x8): multiple definition of `byte_code'
/tmp/gplcXiDz6a.o(.bss+0x8): first defined here
collect2: ld returned 1 exit status
compilation failed
and that on two different computers with mandrake 8.1 and mandrake 8.2.
(x86 version). It compiles with gprolog 1.2.9 but I need a version
greater or equal to
1.2.12 (because of the patches). Could someone be so kind as to try and
compile the program? Like that, I will get a better idea where the
problem comes from.
Dear Erick,
I believe this is a bug in GNU Prolog and, more specifically,
of the header file gprolog.h. In fact, the version installed
by GNU Prolog 1.2.14 contains the following variable declarations
at lines 1863, 1864 and 2012, respectively:
int last_read_line;
int last_read_col;
...
unsigned *byte_code;
Header files should never contain such things.
As a temporary workaround you may want to have
all your C++ code into one compilation unit.
For instance, you could write a new file
all_preds.cpp containing
#include "pred1.cpp"
#include "pred2.cpp"
and then do
gplc --c-compiler g++ -L '-lstdc++' test.pl all_preds.cpp
This may not work in versions of GNU Prolog prior to 1.2.14
because of the lack of multiple inclusion guards in gprolog.h.
All the best
Roberto
--
Prof. Roberto Bagnara
Computer Science Group
Department of Mathematics, University of Parma, Italy
http://www.cs.unipr.it/~bagnara/
mailto:address@hidden