Xcode C Vectors:未定义模板的隐式实例化

新手上路,请多包涵

我在另一个 IDE 上运行了这段代码,它成功了。出于某种原因,我在 Xcode 上收到上述错误消息。我想我错过了某种标题,但我不确定是哪一个。

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

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

原文由 Nathan Hale 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 1.1k
1 个回答

Xcode 10.2.1 向我显示错误 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;
}

修复了我的问题。

原文由 Sauvik Dolui 发布,翻译遵循 CC BY-SA 4.0 许可协议

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题