Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
私は Eclipse の c++ で std::string の非常に基本的な使用法を行っていますが、なぜ機能しないのかわかりません。
サンプルコード:
std::string str = "hello"; cout << str << ":" str.length();
コードは次のエラーでコンパイルされていません:Method 'length' could not be resolved
Method 'length' could not be resolved
なんで?
「<<」がありません
cout << str << ":" << str.length();
ファイルの先頭に #include を必ず付けてください。ただし、 std::string を解決できない場合は、解決できないというエラーが表示されると思います。