0

I'm trying to build a C/C++ project on my mac. Unfortunately it does not compile with Apples gcc:

In file included from /src/connectionmanager.cpp:20:
/src/network.h:98:14: error: implicit instantiation of undefined
      template 'std::__1::basic_string<char, std::__1::char_traits<char>,
      std::__1::allocator<char> >'
        std::string connectToIp;
                    ^
/Library/Developer/CommandLineTools/usr/include/c++/v1/iosfwd:193:32: note: template is declared here
    class _LIBCPP_TEMPLATE_VIS basic_string;
                               ^
1 error generated.
make[2]: *** [CMakeFiles/maxr.dir/src/connectionmanager.cpp.o] Error 1
make[1]: *** [CMakeFiles/maxr.dir/all] Error 2
make: *** [all] Error 2

With GNU gcc version 9.1.0 all source files compile without a problem, but unfortunately cannot be linked by Apples linker.

Are there some compatibility flags for Apples gcc to make it accept code that GNUs gcc compiles without a problem?

This is the Apple gcc version:

$ gcc -v
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/c++/4.2.1
Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Target: x86_64-apple-darwin18.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
user1785730
  • 3,150
  • 4
  • 27
  • 50
  • 3
    `network.h` is missing `#include `. – melpomene Jul 10 '19 at 18:47
  • 2
    For an explanation of why there might be different behaviours with different compilers, see [this question](https://stackoverflow.com/questions/9539650/why-does-omission-of-include-string-only-sometimes-cause-compilation-failur). – Sam Rice Jul 10 '19 at 18:50

0 Answers0