-4
マップを関数の引数として使用し、未定義参照エラーを取得しようとしています。未定義参照
#include<iostream>
#include<map>
using namespace std;
void word_frequency(map<string,int> &doc,ifstream &file){
}
int main(){
map<string,int> doc1;
ifstream file;
file.open("doc1.txt");
word_frequency(doc1,file);
file.close();
return 0;
}
エラー:
undefined reference to `word_frequency(std::map<std::string, int, std::less<std::string>, std::allocator<std::pair<std::string const, int> > >&, std::basic_ifstream<char, std::char_traits<char> >&)'
エラーは、質問のテキストにエラーがあると便利です。どのような線が原因であると推測するのですか? – StoryTeller
@StoryTellerが言ったことは、あなたのコンパイラのコマンドラインを教えてください。 – user0042
'std :: ifstream'を使用するには' 'を含めます。その後、これは再現可能な問題ではありません。 –
StoryTeller