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

本文介绍了解决SourceInsight中出现“parsetoocomplex”错误的方法,包括调整条件预编译指令的解析设置及限制构造函数初始化列表的长度。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >


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.youkuaiyun.com/xheditor/xheditor_emot/default/mad.gif" />("")
						, str_ad_codetype_id("")
						, str_code("")
						, n_win_price("")
						, str<img alt="微笑" src="http://static.blog.youkuaiyun.com/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.youkuaiyun.com/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.youkuaiyun.com/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.youkuaiyun.com/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.youkuaiyun.com/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.youkuaiyun.com/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.youkuaiyun.com/xheditor/xheditor_emot/default/sad.gif" />("")
						, fea_db(NULL)
						, b_is_rtb(false)
						, str_<img alt="委屈" src="http://static.blog.youkuaiyun.com/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


评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值