Today, I encountered a weird problem. When I used eclipse to debug C ++ programs in Linux, the compilation was successful, but I couldn't go anywhere after a single step, the phenomenon is very random. The same code is completely correct in windows. By gradually commenting on the code, it is possible that multiple variables of the STD: string type are added consecutively, for example:
STD: String strwordsort = m_stroutpath + cutil: separator () + total_wordsort_file;
STD: String strscoresort = m_stroutpath + cutil: separator () + total_scoreorts_file;
STD: String strfilebad = m_stroutpath + cutil: separator () + bad_score_file;
STD: String strfilestatic = m_stroutpath + cutil: separator () + statistics_file;
However, it was found that sometimes only STD: String strwordsort = m_stroutpath + cutil: separator () + total_wordsort_file; is used, and sometimes it goes to STD: String strfilestatic = m_stroutpath + cutil :: separator () + statistics_file. Then I wondered whether the problem of adding the macro was not a problem, so I changed it:
STD: String strwordsort = m_stroutpath + cutil: separator () + "XX ";
STD: String strscoresort = m_stroutpath + cutil: separator () + "XX ";
STD: String strfilebad = m_stroutpath + cutil: separator () + "XX ";
STD: String strfilestatic = m_stroutpath + cutil: separator () + "XX ";
And then change it:
STD: String strwordsort = m_stroutpath + cutil: separator (); strwordsort + = total_wordsort_file;
STD: String strscoresort = m_stroutpath + cutil: separator (); strscoresort + = total_scoreorts_file;
STD: String strfilebad = m_stroutpath + cutil: separator (); strfilebad + = bad_score_file;
STD: String strfilestatic = m_stroutpath + cutil: separator (); strfilestatic + = statistics_file;
If the problem is solved, consider whether the initial value must be defined first, and whether many strings cannot be added when the initial value is defined, and then change:
STD: String strwordsort, strscoresort, strfilebad, strfilestatic;
Strwordsort = m_stroutpath + cutil: separator () + total_wordsort_file;
Strscoresort = m_stroutpath + cutil: separator () + total_scoreorts_file;
Strfilebad = m_stroutpath + cutil: separator () + bad_score_file;
Strfilestatic = m_stroutpath + cutil: separator () + statistics_file;
Well, after definition, it's okay to add multiple strings in a row, but why is the STD: string still not clear? I need to study it again and write it down as a question first. STD: The use of string in Linux/Windows is different. It is better to define it before adding and assigning values to multiple strings.