您的位置:首页 > 编程语言 > C语言/C++

Parse Too complex in xxxx.cpp --------source insight

2015-11-24 16:49 501 查看


Source Insight,某些文件出现“parse too complex”,如何解决?

查看网上的解决方案都是

SI的一个很有用的功能是可以列出所有的函数名和变量名,然而在Source Insight的工程中,偶尔会遇到那么一两个文件,里面的函数名和变量名无法解析,提示“parse too complex”。难道这段程序真的复杂到SI都不认识了吗?非也。这其中的罪魁祸首就是条件预编译指令。

在一个Source Insight工程中,它里面所有的没有确定数值的宏都被认为是有效的,那么对于类似#ifdef...#else...#endif这样的分支结构,如果在#ifdef和#else这两个分支分别写一个大括号{,而在#endif之后写上大括号的另一半},而这些大括号又都是有效的话,后果显而易见:由于左半边大括号多了一个,括号不配对,导致所有后边的代码被看作是该括号内部的内容,直到文件结束。。

示例代码:

#ifdef COMPLEX

{

#else

{

#endif

}

解决办法:在Options->Preferences->Languages->Conditional Parsing的设置处,在Project Specific Conditions中设置该宏为true、false还是忽略。当设置宏COMPLEX为true或false之后,上面示例的两个左大括号就只有一个有效,代码可以被正确解析了。

但是我试了下,根本没有解决我的问题

后来发现是初始化列表长度的问题,如果初始化类别的行数超过50行,就会出现上述问题,

sdk_buyout_code_strategy::sdk_buyout_code_strategy()
: str_pos_id("")
, str_combine_id("")
, str_<img alt="生气" src="http://static.blog.csdn.net/xheditor/xheditor_emot/default/mad.gif" />("")
, str_ad_codetype_id("")
, str_code("")
, n_win_price("")
, str<img alt="微笑" src="http://static.blog.csdn.net/xheditor/xheditor_emot/default/smile.gif" />("")
, str_token("")
, str_win_price("")
, s_exchange_rate("")
, str_en_win_price("")
, str_tid("")
, str_creative_id("")
, str_ask_price("")
, str_<img alt="害羞" src="http://static.blog.csdn.net/xheditor/xheditor_emot/default/shy.gif" />("")
, str_tem_en_extend("")
, str_ext_data("")
, str_flu_provide_type("")
, str_book_id("")
, str_click_url("")
, str_native_title("")
, str_<img alt="吐舌头" src="http://static.blog.csdn.net/xheditor/xheditor_emot/default/tongue.gif" />("")
, str_native_mainimage("")
, str_native_iconimage("")
, str_run_src("")
, str_run_width("")
, str_run_height("")
, str_<img alt="奋斗" src="http://static.blog.csdn.net/xheditor/xheditor_emot/default/struggle.gif" />("")
, str_winnotice_url("")
, str_imp_url("")
, p_materials_new(NULL)
, p_material(NULL)
, str_<img alt="偷笑" src="http://static.blog.csdn.net/xheditor/xheditor_emot/default/titter.gif" />("")
, str_last_impurl_base64("")
, str_last_impurl_escape("")
, str_last_impurllist_json("")
, bk_obj(NULL)
, str_monitor_url("")
, str_<img alt="大笑" src="http://static.blog.csdn.net/xheditor/xheditor_emot/default/laugh.gif" />("")
, str_last_clkurl_base64("")
, str_last_clkurllist_json("")
, str_last_clkurl_escape("")
, str_<img alt="难过" src="http://static.blog.csdn.net/xheditor/xheditor_emot/default/sad.gif" />("")
, fea_db(NULL)
, b_is_rtb(false)
, str_<img alt="委屈" src="http://static.blog.csdn.net/xheditor/xheditor_emot/default/wronged.gif" />("")
, n_platform(0)
, ad_types_id(0)
, str_refresh_time("")
<span style="color:#ff0000;">, str_last_reqTrackerurl(""), str_pos_width(""), str_pos_height("")</span>
{
regist_replace_str();
}


把初始化列表的行数控制在50行以内,这个问题就会解决

这应该是source insight 本身的bug
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: