Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Implicit instantiation of undefined template error for macos g++ compiler #231

Closed
iedmrc opened this issue May 12, 2019 · 5 comments
Closed

Comments

@iedmrc
Copy link
Contributor

iedmrc commented May 12, 2019

With macos xcode compiler:

Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/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.5.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

I get the following errors while building the source:

c++ -MMD -MP -I. -std=c++14 -Wextra -Wpedantic -Wall -O3 -c algorithms/kruskal.cpp -o algorithms/kruskal.o
In file included from algorithms/kruskal.cpp:14:
In file included from ./algorithms/kruskal.h:13:
In file included from ./structures/generic/undirected_graph.h:17:
In file included from ./structures/generic/edge.h:13:
./structures/typedefs.h:42:19: error: implicit instantiation of undefined template 'std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >'
const std::string DEFAULT_PROFILE = "car";
                  ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/iosfwd:193:32: note: template is declared here
    class _LIBCPP_TEMPLATE_VIS basic_string;
                               ^
In file included from algorithms/kruskal.cpp:14:
In file included from ./algorithms/kruskal.h:13:
In file included from ./structures/generic/undirected_graph.h:17:
In file included from ./structures/generic/edge.h:13:
./structures/typedefs.h:49:15: error: implicit instantiation of undefined template 'std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >'
  std::string host;
              ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/iosfwd:193:32: note: template is declared here
    class _LIBCPP_TEMPLATE_VIS basic_string;
                               ^
In file included from algorithms/kruskal.cpp:14:
In file included from ./algorithms/kruskal.h:13:
In file included from ./structures/generic/undirected_graph.h:17:
In file included from ./structures/generic/edge.h:13:
./structures/typedefs.h:50:15: error: implicit instantiation of undefined template 'std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >'
  std::string port;
              ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/iosfwd:193:32: note: template is declared here
    class _LIBCPP_TEMPLATE_VIS basic_string;
                               ^
3 errors generated.
make: *** [algorithms/kruskal.o] Error 1

@jcoupey
Copy link
Collaborator

jcoupey commented May 13, 2019

Thanks for reporting. Why different compilers have different behaviours with regard to includes is beyond me...

--with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/c++/4.2.1

Can you confirm that 4.2.1 is your clang version? This would explain why our Travis builds don't catch this as we're only building with clang 5 and 6.

@iedmrc
Copy link
Contributor Author

iedmrc commented May 13, 2019

Apple's versioning a bit confusing. So I am not sure the version of clang I have. I just have the following:
Apple LLVM version 10.0.1 (clang-1001.0.46.4) Target: x86_64-apple-darwin18.5.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Although I thought the toolchain version history table may be helpful, it is not https://en.wikipedia.org/wiki/Xcode

@jcoupey
Copy link
Collaborator

jcoupey commented May 13, 2019

Is running clang --version any help?

@iedmrc
Copy link
Contributor Author

iedmrc commented May 13, 2019

I did give a try, but It is just the same:

$ clang --version
Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Target: x86_64-apple-darwin18.5.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

@jcoupey
Copy link
Collaborator

jcoupey commented May 13, 2019

Fixed in #232.

@jcoupey jcoupey closed this as completed May 13, 2019
@jcoupey jcoupey added this to the v1.5.0 milestone Sep 17, 2019
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants