1
.Compiler Warning (level 1) C4717
warning C4717: 'CTestView::OnCreate' : recursive on all control paths, function will cause runtime stack overflow//本人遇到
下为网络转载:
Error Message
'function' : recursive on allcontrolpaths, functionwillcauseruntimestackoverflow
如下面代码:
#include "wingdi.h"
HPEN Graphics::CreatePen( int penStyles /*= PS_SOLID*/, COLORREF penCol /*= RGB(255, 255, 255)*/, int thickness /*= 1*/ )
{
HPEN ahPen = CreatePen(penStyles, thickness, penCol);
return ahPen;
}
这样在编译的时候,编译器会提示warningC4717: 'GDIEngine::Graphics::CreatePen' : recursive on allcontrolpaths, functionwillcauseruntimestackoverflow
导致这样问题的原因是:编译器不知道HPEN ahPen = CreatePen(penStyles, thickness, penCol);调用的CreatePen是哪一个。
解决问题:
HPEN Graphics::CreatePen( int penStyles /*= PS_SOLID*/, COLORREF penCol /*= RGB(255, 255, 255)*/, int thickness /*= 1*/ )
{
HPEN ahPen = ::CreatePen(penStyles, thickness, penCol);
return ahPen;
}