binji / binjgb

Gameboy emulator implemented in C, that also runs in the browser
https://binji.github.io/binjgb/
MIT License
534 stars 61 forks source link

Fixes compile errors for implicit instantiation on osx #15

Closed aconbere closed 5 years ago

aconbere commented 5 years ago

I was trying to build on OSX this weekend and ran into a couple of compilation errors (warning I am NOT experienced at C or C++ so totally understand if there is something else going on here). This diff fixes the issue on my machine (OSX 10.13.6 high sierra)

Apple LLVM version 10.0.0 (clang-1000.11.45.5)
Target: x86_64-apple-darwin17.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
[master]? % make                             
/Applications/Xcode.app/Contents/Developer/usr/bin/make --no-print-directory -C out/Debug
[ 16%] Built target binjgb-tester
[ 16%] Built target binjgb-tester-copy-to-bin
Scanning dependencies of target binjgb-debugger
[ 18%] Building CXX object CMakeFiles/binjgb-debugger.dir/src/debugger/rewind-window.cc.o
[ 20%] Building CXX object CMakeFiles/binjgb-debugger.dir/src/debugger/rom-window.cc.o
/Users/anders/Projects/binjgb/src/debugger/rom-window.cc:61:41: error: implicit instantiation of undefined template
      'std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >'
    ImGui::Text("Unknown: %s (%.0f%%)", d->PrettySize(usage_bytes[0]).c_str(),
                                        ^
/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;
                               ^
/Users/anders/Projects/binjgb/src/debugger/rom-window.cc:63:38: error: implicit instantiation of undefined template
      'std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >'
    ImGui::Text("Data: %s (%.0f%%)", d->PrettySize(usage_bytes[2]).c_str(),
                                     ^
/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;
                               ^
/Users/anders/Projects/binjgb/src/debugger/rom-window.cc:65:38: error: implicit instantiation of undefined template
      'std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >'
    ImGui::Text("Code: %s (%.0f%%)", d->PrettySize(usage_bytes[3]).c_str(),
                                     ^
/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;