我有一个代码片段:
string opposite(string c)
{
if(c == (string) "\""){return "\"";}
if(c == (string) "<"){return ">";}
throw;
}
int load_end(int start, string code)
{
//start is the begining of "header.h" or <header> in #load "header.h" or #load <header>
//code is self explanitory
//This function returns the end of "header.h" or <header> in #load "header.h" or #load
string chr = " ";
int e;
string asdf = opposite(code[start]);
for(int i = start; chr == asdf; i++)
{
e = i;
chr = code[i];
}
return e;
}
在定义“asdf”的单词所在的行发生错误;“从 'char' 到 'const char*”的无效转换”[-fpermissive]”。还会出现另一个错误:“c:\mingw\bin..\lib\gcc\mingw32\4.6.2\include\c++\bits\ basic_string.tcc|214|错误:初始化 'std::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, const _Alloc&) 的参数 1 [with _CharT = char, _Traits = std::char_traits, _Alloc = std::allocator]' [-fpermissive]|"。这些错误对我来说是如何引起的毫无意义。