Я получаю некоторые сообщения об ошибках при попытке скомпилировать cppTableMaker.cpp
, но это указывает на библиотеку, созданную не мной.
1>------ Build started: Project: cppTableMaker, Configuration: Debug Win32 ------
1>cppTableMaker.cpp
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.24.28314\include\xtree(1373,13): error C2675: unary '++': '_Iter' does not define this operator or a conversion to a type acceptable to the predefined operator
1> with
1> [
1> _Iter=std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t>>
1> ]
1>G:\My Drive\coding\C++\cppTableMaker\cppTableMaker.cpp(31): message : see reference to function template instantiation 'void std::_Tree<std::_Tmap_traits<_Kty,_Ty,_Pr,_Alloc,false>>::insert<std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t>>>(_Iter,_Iter)' being compiled
1> with
1> [
1> _Kty=std::wstring,
1> _Ty=std::vector<std::wstring,std::allocator<std::wstring>>,
1> _Pr=std::less<std::wstring>,
1> _Alloc=std::allocator<std::pair<const std::wstring,std::vector<std::wstring,std::allocator<std::wstring>>>>,
1> _Iter=std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t>>
1> ]
1>G:\My Drive\coding\C++\cppTableMaker\cppTableMaker.cpp(31): message : see reference to function template instantiation 'void std::_Tree<std::_Tmap_traits<_Kty,_Ty,_Pr,_Alloc,false>>::insert<std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t>>>(_Iter,_Iter)' being compiled
1> with
1> [
1> _Kty=std::wstring,
1> _Ty=std::vector<std::wstring,std::allocator<std::wstring>>,
1> _Pr=std::less<std::wstring>,
1> _Alloc=std::allocator<std::pair<const std::wstring,std::vector<std::wstring,std::allocator<std::wstring>>>>,
1> _Iter=std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t>>
1> ]
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.24.28314\include\xtree(1374,36): error C2100: illegal indirection
1>G:\My Drive\coding\C++\cppTableMaker\cppTableMaker.cpp(183,1): fatal error C1903: unable to recover from previous error(s); stopping compilation
1>INTERNAL COMPILER ERROR in 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.24.28314\bin\HostX86\x86\CL.exe'
1> Please choose the Technical Support command on the Visual C++
1> Help menu, or open the Technical Support help file for more information
1>Done building project "cppTableMaker.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Похоже, оно исходит от:
#include <string>
#include <vector>
#include <map>
#include "cppTableMaker.h"
#include "common.cpp"
#include <locale>
#include <codecvt>
#include <sstream>
//bunch of functions and methods, and the table::modernTable::column class. (there's no main())
std::vector<int> table::modernTable::ins(std::vector<std::wstring> values)
{
this->row ++;
auto local_data = this->data;
std::vector<int> local_colMaxLen = this->colMaxLen;
int loopCount{ 0 };
for (auto const& [key, val] : local_data)
{
local_data.insert(key, std::wstring(values.at(loopCount))); //there's some info pointing to the first column of this line.
local_colMaxLen.at(loopCount) = max(local_colMaxLen.at(loopCount), max(values.at(loopCount).length(), key.length()));
loopCount ++;
}
this->colMaxLen = local_colMaxLen;
this->data = local_data;
return local_colMaxLen;
}
включенного заголовочного файла cppTableMaker.h
:
#pragma once
#include <string>
#include <map>
#include <vector>
#ifndef cppTableMaker_h
#define cppTableMaker_h
namespace table {
class modernTable {
public:
//variables
std::map<std::wstring, std::vector<std::wstring>> data;
int row{ 0 };
std::vector<int> colMaxLen{};
//init
modernTable(std::map<std::wstring, std::vector<std::wstring>> data_INPUT, int row_INPUT, std::vector<int> colMaxLen_INPUT); //constructer
// ~modernTable(); //destructer
//methods
std::vector<int> ins(std::vector<std::wstring>); //this function might be the cause
std::wstring get();
std::vector<std::wstring> rm(int rowNum);
class column;
auto col(std::wstring name);
void mv(int index);
void mvto(int index);
};
//other classes
}
#endif
В common.cpp
нет ничего особенного. Он содержит только функцию max()
.
Так в чем же проблема моего сценария? Что это значит? Я изменил все ++
на +1
, и проблема все еще существует. Просто не имеет смысла, что ошибка происходит в стандартной библиотеке. Могу ли я избавиться от этого? Как и почему?