delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/06/02/09:55:57

Sender: nathan AT kosh DOT larc DOT nasa DOT gov
Message-ID: <3574046C.EBFE2F25@larc.nasa.gov>
Date: Tue, 02 Jun 1998 09:55:56 -0400
From: "Nathan T. Moore" <n DOT t DOT moore AT larc DOT nasa DOT gov>
MIME-Version: 1.0
To: djgpp AT delorie DOT com
Subject: Includes and some interesting errors

I'm not new to programming, but I am new to DJPP. I had 2.7.x working
quite well, and had no trouble compiling various programs with it. I
recently updated to 2.8.1 and have been experiencing a problem not seen
here in the ng.

I am fairly sure I have the right files (I used the zip picker to tell
me what I needed). When I installed the new version I totally wiped out
the old (ie deleted all the directories associated with it). I've read
the gnu/gcc-28.1/problems.txt file, and looked at what I considered
relevant in the FAQ and did not find an answer to my problem.

In short, my problem happens when I include both math.h and
vector/vector.h in a file. Apparently (and I'm not a champion of reading
error messages), there is an exception struct used twice, and it *seems*
like there is a missing #ifdef ... #endif in a header file somewhere,
but I could be wrong. The C/C++ linkage error message goes over my head
though. This file, and the ones I'm working with compiled fine under
2.7.x.

I would appreciate any help that could be offered (and if it is an RTFM,
please point me in the right direction). I'll try to keep up with the
ng, but an E-mail reply would be great!

TIA,
Nathan

Consider this dummy file:

#include <math.h>
/* <vector> or <vector.h>, either way. STL book uses <vector> */
#include <vector>

int main()
{
  int i = 0;
  return 0;
}


compile this as:
gcc -v -c problem.cpp
or
gxx -v -c problem.cpp

(note: reversing the order of the vector/math includes will slightly
change the error messages)

and you will get this error message:
(if gcc)
Reading specs from d:/scratch/nathan/lib/specs
(if gxx)
Reading specs from d:/scratch/nathan/lib/gcc-lib/djgpp/2.81/specs
(rest the same)

gcc version 2.8.1
 d:/scratch/nathan/lib/gcc-lib/djgpp/2.81/cpp.exe -lang-c++ -v -undef
-D__GNUC__
=2 -D__GNUG__=2 -D__cplusplus -D__GNUC_MINOR__=8 -Dunix -Di386 -DGO32
-DMSDOS -D
DJGPP=2 -DDJGPP_MINOR=1 -D__unix__ -D__i386__ -D__GO32__ -D__MSDOS__
-D__DJGPP__
=2 -D__DJGPP_MINOR__=1 -D__unix -D__i386 -D__GO32 -D__MSDOS -D__DJGPP=2
-D__DJGP
P_MINOR=1 -D__EXCEPTIONS problem.cpp d:/scratch/nathan/tmp/ccaiavve
GNU CPP version 2.8.1 (80386, BSD syntax)
#include "..." search starts here:
#include <...> search starts here:
 d:/scratch/nathan/lang/cxx
 d:/scratch/nathan/include
 d:/scratch/nathan/lang/cxx
 d:/scratch/nathan/lib/gcc-lib/djgpp/2.81/include
 d:/scratch/nathan/include
End of search list.
 d:/scratch/nathan/lib/gcc-lib/djgpp/2.81/cc1plus.exe
d:/scratch/nathan/tmp/ccaiavve -quiet -dumpbase problem.cc -version -o
d:/scratch/nathan/tmp/ccbiavve
GNU C++ version 2.8.1 (djgpp) compiled by GNU C version 2.8.1.
In file included from
d:/scratch/nathan/lib/gcc-lib/djgpp/2.81/include/new:9,
                 from
d:/scratch/nathan/lib/gcc-lib/djgpp/2.81/include/new.h:6,
                 from d:/scratch/nathan/lang/cxx/stlalgobase.h:52,
                 from d:/scratch/nathan/lang/cxx/vector:30,
                 from problem.cpp:2:
d:/scratch/nathan/lib/gcc-lib/djgpp/2.81/include/exception:15:
redefinition of `struct exception'
d:/scratch/nathan/include/math.h:79: previous definition here
d:/scratch/nathan/include/math.h:79: previous declaration of
`exception::exception()' with C linkage
d:/scratch/nathan/lib/gcc-lib/djgpp/2.81/include/exception:17: conflicts
with new declaration with C++ linkage
d:/scratch/nathan/include/math.h:79: previous declaration of
`exception::exception(const struct exception &)' with C linkage
d:/scratch/nathan/lib/gcc-lib/djgpp/2.81/include/exception:20: conflicts
with new declaration with C++ linkage
d:/scratch/nathan/include/math.h:79: previous declaration of `struct
exception & exception::operator =(const struct exception &)' with C
linkage
d:/scratch/nathan/lib/gcc-lib/djgpp/2.81/include/exception:20: conflicts
with new declaration with C++ linkage

- Raw text -


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