Implicit instantiation of undefined template 'std::basic_ifstream<char,std::char_traits<char>>'
Tại sao tôi nhận được lỗi ifstream này?
#ifndef MAPPER_H
#define MAPPER_H
#include <iostream>
#include <string>
#include <vector>
#include "KeyValue.h"
#include "Parser.h"
using namespace std;
class Mapper
{
public:
Mapper(ifstream& infile);
~Mapper(void);
void loadTokens();
void showTokens();
void map();
void printMap();
void printMap(string map_fileName);
private:
ifstream inFile; //<-- is where the error is happening
vector<string> tokens;
vector<KeyValue> map_output;
Parser* parser;
};
#endif
Tôi thậm chí đã cố gắng đưa std::ifstream
và nó vẫn không hoạt động.
Khi tôi #include <fstream>
thay vì #include <iostream>
, tôi nhận được những sai sót trong fstream.tcc
và basic_ios.tcc
:
'operator=' is a private member of 'std::basic_streambuf<char>'
Và kể từ đó là một phần của thư viện fstream, rõ ràng là một cái gì đó tôi đang làm là sai ...
Bất kỳ ai cũng có thể trợ giúp?
Bạn phải có '' thay vì ' 'Toán tử' = 'là lỗi thực. Cửa sổ đầu ra sẽ có phần còn lại của thông báo lỗi đó, bao gồm số dòng nơi bạn tạo một bản sao của đối tượng 'Mapper'. –
Bạn cần hiển thị mã gây ra lỗi thứ hai. –