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;
}?
??????