1 .Compiler? Warning (level 1)? C4717
warning C4717: 'CTestView::OnCreate' : recursive on all control paths, function will cause runtime stack overflow//本人遇到
下為網(wǎng)絡(luò)轉(zhuǎn)載:
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;
}

這樣在編譯的時(shí)候,編譯器會(huì)提示warningC4717: 'GDIEngine::Graphics::CreatePen' : recursive on allcontrolpaths, functionwillcauseruntimestackoverflow

導(dǎo)致這樣問題的原因是:編譯器不知道HPEN ahPen = CreatePen(penStyles, thickness, penCol);調(diào)用的CreatePen是哪一個(gè)。

解決問題:
HPEN Graphics::CreatePen( int penStyles /*= PS_SOLID*/, COLORREF penCol /*= RGB(255, 255, 255)*/, int thickness /*= 1*/ )
{
HPEN ahPen = ::CreatePen(penStyles, thickness, penCol);
return ahPen;
}
?
??????