Xcode C++ Vectors: Implicit instantiation of undefined template

Nathan Hale picture Nathan Hale · Mar 13, 2018 · Viewed 20.7k times · Source

I ran this code on a different IDE and it was successful. For some reason I get the above error message on Xcode. I assume I'm missing a header of some kind, but I'm not sure which one.

#include <iostream>
#include <limits>
#include <string>
#include <vector>

int main() {
    vector<string> listRestaurants;  // error: Implicit instantiation of undefined template
    return 0;
}

Answer

Sauvik Dolui picture Sauvik Dolui · Jun 17, 2019

Xcode 10.2.1 was showing me the error Implicit instantiation of undefined template 'std::__1::vector<std::__1::basic_string<char>, std::__1::allocator<std::__1::basic_string<char> > >'.

#include <iostream>
#include <vector>
int main(int argc, const char * argv[]) {
  std::vector<std::string> listRestaurants;

  ....
  return 0;
}

Fixed my issue.