[mercury-users] Strange C++ compilation problem

Ondrej Bojar oboj7042 at ss1000.ms.mff.cuni.cz
Thu Aug 22 23:39:21 AEST 2002


Hi.

I try to compile a C++ code that depends on Mercury code as well.
The core dependencies of files are:

goal: db_cint.o

db_cint.o: db_cint.cc
db_cint.cc: db_cint.h
db_cint.h: db_mint.h seznam.h

# C++ code
seznam.o: seznam.cpp
seznam.cpp: seznam.h

# Mercury's part of the interface (db_*m*int)
db_mint.h: db_mint.o
db_mint.o: db_mint.m

The object seznam.o itself is just fine, it compiles with gcc without any
problems.

Problem arises, when I try to compile db_cint.o. This must be done with
mgnuc, due to the dependency on db_mint.h, which relies on mercury.h.
But mgnuc rejects the included seznam.h on my current machine. (It works
fine on another machine...)

Here is the mmake log, I hope all necessary version information is in it.

mgnuc --high-level-code     --c-debug --no-c-optimize -I ../milan -I
../../../src/ent/mikulas/simple/ -v    -I../../../src/shared/ -I.
-I../../../src/shared/comm/ -I../../../src/ent/mikulas/simple/ -g     -c
db_cint.cc
Reading specs from /usr/lib/gcc-lib/i386-slackware-linux/2.95.3/specs
gcc version 2.95.3 20010315 (release)
 /usr/lib/gcc-lib/i386-slackware-linux/2.95.3/cpp0 -lang-c++ -v -I/usr/local/mercury-rotd-2001-09-24/lib/mercury/inc -I ../milan -I ../../../src/ent/mikulas/simple/ -I../../../src/shared/ -I. -I../../../src/shared/comm/ -I../../../src/ent/mikulas/simple/ -I/usr/local/include -D__GNUC__=2 -D__GNUG__=2 -D__GNUC_MINOR__=95 -D__cplusplus -trigraphs -D__STRICT_ANSI__ -D__ELF__ -D__unix__ -D__i386__ -D__linux__ -D__unix -D__linux -Asystem(posix) -D__EXCEPTIONS -g -g -Wall -Wwrite-strings -Wshadow -Wstrict-prototypes -Wmissing-prototypes -Wno-unused -Wno-uninitialized -Acpu(i386) -Amachine(i386) -D__i386 -D__i386__ -DMR_HIGHLEVEL_CODE -DCONSERVATIVE_GC -DNO_SIGNALS db_cint.cc /tmp/cc3K5kdU.ii
GNU CPP version 2.95.3 20010315 (release) (i386 Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/mercury-rotd-2001-09-24/lib/mercury/inc
 ../milan
 ../../../src/ent/mikulas/simple
 ../../../src/shared
 .
 ../../../src/shared/comm
 ../../../src/ent/mikulas/simple
 /usr/local/include
 /usr/lib/qt-3.0.4/include
 /usr/lib/gcc-lib/i386-slackware-linux/2.95.3/../../../../include/g++-3
 /usr/local/include
 /usr/lib/gcc-lib/i386-slackware-linux/2.95.3/include
 /usr/include
End of search list.
The following default directories have been omitted from the search path:
 /usr/lib/gcc-lib/i386-slackware-linux/2.95.3/../../../../i386-slackware-linux/include
End of omitted list.
 /usr/lib/gcc-lib/i386-slackware-linux/2.95.3/cc1plus /tmp/cc3K5kdU.ii -quiet -dumpbase db_cint.cc -g -g -Wall -Wwrite-strings -Wshadow -Wstrict-prototypes -Wmissing-prototypes -Wno-unused -Wno-uninitialized -ansi -version -o /tmp/ccP8L00W.s
GNU C++ version 2.95.3 20010315 (release) (i386-slackware-linux) compiled by GNU C version 2.95.3 20010315 (release).
In file included from db_cint.h:29,
                 from db_cint.cc:2:
../milan/seznam.h:49: ANSI C++ forbids declaration `CHandlSeznam' with no type
../milan/seznam.h:49: ANSI C++ forbids data member `CHandlSeznam' with same name as enclosing class
../milan/seznam.h:49: declaration of `const int CHandlSeznam::CHandlSeznam'
../milan/seznam.h:47: conflicts with previous declaration `void CHandlSeznam::CHandlSeznam(int)'
../milan/seznam.h:49: parse error before `&'
../milan/seznam.h:123: invalid use of undefined type `class CHandlSeznam'
../milan/seznam.h:42: forward declaration of `class CHandlSeznam'
../milan/seznam.h:123: `SezParam' was not declared in this scope
../milan/seznam.h:123: parse error before `)'
../milan/seznam.h:131: invalid use of undefined type `class CHandlSeznam'
../milan/seznam.h:42: forward declaration of `class CHandlSeznam'
../milan/seznam.h:131: `SezParam' was not declared in this scope
../milan/seznam.h:131: declaration of `int CHandlSeznam::kopie_seznamu'
../milan/seznam.h:123: conflicts with previous declaration `int CHandlSeznam::kopie_seznamu(...)'
In file included from db_cint.h:34,
                 from db_cint.cc:2:
../milan/veta.h:1092: confused by earlier errors, bailing out
gmake[1]: *** [db_cint.o] Error 1


I really don't know, what should I try (except for compiling a newer gcc,
right now I'm trying to compile 3.1.1).

Thanks in advance, Andrew.

P.S.: I attached some of the source codes, the problematic part of
seznam.h looks quite innocent:

class CHandlSeznam {

public:
  CHandlSeznam();  ///implicitni konstruktor
  CHandlSeznam(const CHandlSeznam& NovySeznam);  ///kopirovaci konstruktor
  ~CHandlSeznam();  ///destruktor

------------vvvvvv  this is the line 49A
  const CHandlSeznam& operator=(const CHandlSeznam& NovySeznam);
  /* operator prirazeni */

  void pridej_na_zacatek(THandl NoveInfo); ///prida novy clen seznamu na
zacatek
  void pridej_na_konec(THandl NoveInfo);  ///prida novy clen seznamu na
konec

...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: problem.tgz
Type: application/x-gzip
Size: 11766 bytes
Desc: 
URL: <http://lists.mercurylang.org/archives/users/attachments/20020822/e0d70437/attachment.bin>


More information about the users mailing list