0

If I try to #include <map> or <set>, I get the following error ..

fatal error: map: No such file or directory
#include <map>
               ^
compilation terminated.

The rest of the STL appears to be there. I can #include <vector> ok.

I'm using the following toolchain

g++ (GCC) 4.9.2 20150212
libstdc++-4.9.2-6.fc21.x86_64
libstdc++-devel-4.9.2-6.fc21.x86_64
NathanOliver
  • 171,901
  • 28
  • 288
  • 402
  • 2
    The required file (`/usr/include/c++/4.9.2/map`) is in the devel package. Your compiler probably did not pick up the required include paths. Please add the compiler command you used and the list of include paths that are searched by gcc (see [this comment](http://stackoverflow.com/questions/17939930/finding-out-what-the-gcc-include-path-is#comment46389867_17940271) for an explanation on how to obtain this list). – Nobody moving away from SE Mar 16 '15 at 16:14
  • Yup. That's where it is. Many thanks. I can add that path to my include path. – Tony Camuso Mar 16 '15 at 16:37
  • When the compiler is configured correctly this should not be necessary. I believe you are using the wrong compiler (e.g. the C compiler) which does not use the C++ include paths. This I why I asked for the exact command that you used for compilation. – Nobody moving away from SE Mar 16 '15 at 16:39
  • What a mess. You'd think they'd have this together by now. Even after adding that to my path ... In file included from /usr/include/c++/4.9.2/bits/stl_tree.h:61:0, from /usr/include/c++/4.9.2/map:60, from ../src/kabi-map.h:25, from ../src/kabi.c:60: /usr/include/c++/4.9.2/bits/stl_algobase.h:59:28: fatal error: bits/c++config.h: No such file or directory #include ^ compilation terminated. – Tony Camuso Mar 16 '15 at 16:41
  • Again, please add the exact compiler command. Your source file is named `kabi.c` which if used with gcc will result in the C compiler being used. You can try to rename the file to `kabi.cpp` (or `kabi.cc`) to let the compiler "guess" that you are trying to compile C++. – Nobody moving away from SE Mar 16 '15 at 16:48
  • @Nobody No joy. [code] /usr/include/c++/4.9.2/bits/functexcept.h:42:1: error: unknown type name 'namespace' namespace std _GLIBCXX_VISIBILITY(default)[/code] – Tony Camuso Mar 16 '15 at 16:53
  • I am sorry, but I won't help you any further without your cooperation. I asked 3 times for the compiler command and you did not even care to explain why you did not give it. This is crucial information without which I (and probably others) am not able to help you. All errors posted so far hint at the fact that you are using a C compiler instead of the C++ one but without the command we cannot be sure what you are doing. – Nobody moving away from SE Mar 16 '15 at 16:57
  • I'm using a makefile, because I am mixing c and c++ (out of absolute necessity, believe me). Anyway, the problem seems to be that I was including outside the area protected by #ifdef __cplusplus. Putting back in that area makes the problem go away. Sorry to have been such a bore (boar, boor, whatever fits). – Tony Camuso Mar 16 '15 at 17:00

0 Answers0