1

I am a C programmer with minimal C++ expertise. I've been trying to download and install the packages from here and here. I run configure and make and for the dsr-pdb, I get a slew or errors such as

../include/dsrpdb/Point.h:69:14: error: 'assert' was not declared in this scope
assert(i < 3);

and for synaps I get

if g++ -DHAVE_CONFIG_H -I. -I. -I../include/synaps   -I/usr/include -I../include -O3 -g -O2 -MT Variables.o -MD -MP -MF ".deps/Variables.Tpo" -c -o Variables.o `test -f '../mpol/src/Variables.cpp' || echo './'`../mpol/src/Variables.cpp; \
    then mv -f ".deps/Variables.Tpo" ".deps/Variables.Po"; else rm -f ".deps/Variables.Tpo"; exit 1; fi
../mpol/src/Variables.cpp: In member function ‘std::string SYNAPS::Variables::operator[](int)’:
../mpol/src/Variables.cpp:16:25: error: ‘sprintf’ was not declared in this scope 
sprintf(str,"%d",i);

These are errors because they didn't #include <cassert> or #include <cstdio> in their source files. I find it strange that two different devs have done this. It made me wonder if there is a compiler option that automatically uses the the appropriate c-header and library files, or maybe they developed in an IDE that lets them get away with it? Or perhaps autoconf or make do something upstream of this?

5
  • 1
    Those devs' minds are not standard-compliant. Commented Oct 2, 2015 at 15:54
  • 5
    IIRC the standard allows standard headers to include other standard headers, so different implementations of the standard library may implicitly provide, say, <cstdio> if you include <iostream>. Commented Oct 2, 2015 at 15:54
  • 1
    This is not about linking. It fails during compilation and never gets to the linking stage. @melpomene: Yes, and IMHO that's unfortunate. It means that errors like this may not be detected. Commented Oct 2, 2015 at 15:59
  • 1
    You also have to consider the possibility that this library is simply of low quality. Commented Oct 2, 2015 at 16:07
  • 1
    I considered that, but I wanted to give them the benefit of the doubt Commented Oct 2, 2015 at 16:08

1 Answer 1

1

gcc has an -include option which lets you force the inclusion of header files from the command line. See https://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_2.html#SEC11

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.