I created a static member m_info_fileclass
:
class FileOperations
{
private:
static std::fstream m_info_file;
static std::string m_index_date; // May be volatile to further changes
static void InitializeFile(bool file_was_created_before);
static void MoveFilePtr(uint32_t p_point);
static std::string GetTimeFromFile();
static bool m_file_was_created_before;
static bool m_file_initialized;
static bool m_class_initialized;
static SearchIndex m_index;
static std::mutex m_index_mutex;
public:
static void Start();
}
and defined it in the source file:
void FileOperations::Start()
{
#pragma region MEMBERS_INNIT
bool m_file_was_created_before;
bool m_file_initialized;
bool m_class_initialized;
std::string m_index_date; // May be volatile to further changes
std::fstream m_info_file;
SearchIndex m_index;
std::mutex m_index_mutex;
#pragma endregion
}
But I am still getting the error. It is worth noting that I’ve done the exact same for other members and it worked perfectly fine.
Here is the error:
Severity Code Description Project File Line Suppression State Details
Error LNK2001 unresolved external symbol "private: static class std::basic_fstream<char,struct std::char_traits<char> > FileOperations::m_info_file" (?m_info_file@FileOperations@@0V?$basic_fstream@DU?$char_traits@D@std@@@std@@A) FileSearchEngine C:UsersbahgesourcereposFileSearchEngineFileOperations.obj 1
New contributor
darb is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
3