incomplete type, afxrendertarget.h

simple vc++ code copied from book, computing of numerical method using vc++ by
Salleh; chapter 3;
Code3A.h, Code3A.cpp
-------------
tested on my visual studio 2017 enterprize, 15.8.7(I instlalled all vc++, MFC,
c++ game related packags)
--------
incomplete type is not allowed, afxrendertarget.h 348

please help (that code can be find in web easily)

thanks a lot in advance



Identify the type that it says is incomplete.

write class <the_type>; somewhere at the top of afxrendertarget.h, and save it
is you mean to search string, afxrendertarget.h,
from whole C directory?

I tried indexing Options,

I can not get files included (it keep search indexing,; keep blank in both fields
below)
-------------
#include <afxwin.h>

class CCode3AA : public CFrameWnd
{

public:
CCode3AA();
~CCode3AA();
afx_msg void OnPaint();
DECLARE_MESSAGE_MAP()
};
class CMyWinApp : public CWinApp
{
public:
virtual BOOL InitInstance();

};



-----------
#include "Code3AA.h"
CMyWinApp MyApplication;
BOOL CMyWinApp::InitInstance()
{
CCode3AA* pFrame = new CCode3AA;
m_pMainWnd = pFrame;
pFrame->ShowWindow(SW_SHOW);
pFrame->UpdateWindow();
return TRUE;
}

BEGIN_MESSAGE_MAP(CCode3AA,CFrameWnd)
ON_WM_PAINT()
END_MESSAGE_MAP()

CCode3AA::CCode3AA()
{
Create(NULL, "Code3A: The Skeleton Program",
WS_OVERLAPPEDWINDOW, CRect(0, 0, 400, 200), NULL);
}

CCode3AA::~CCode3AA()
{
}
void CCode3AA::OnPaint()
{
CPaintDC dc(this);
dc.TextOut(100, 30, "Welcome to Windows...");
}
---------------------------------------------------------------------------------
I install all packages from launch/modify for my 2017 visual studio Enterprize.
still got same error at build
Last edited on
Find the file afxrendertarget.h on your PC.

When you find it, come back.
fsshl@alice /cygdrive/c/Program Files (x86)
$ cd "Microsoft Visual Studio"

fsshl@alice /cygdrive/c/Program Files (x86)/Microsoft Visual Studio
$ ls
2017 Installer Shared

fsshl@alice /cygdrive/c/Program Files (x86)/Microsoft Visual Studio
$ cd 2017

fsshl@alice /cygdrive/c/Program Files (x86)/Microsoft Visual Studio/2017
$ ls
Enterprise Professional

fsshl@alice /cygdrive/c/Program Files (x86)/Microsoft Visual Studio/2017
$ grep -r "afxrendertarget.h"
Enterprise/VC/Tools/MSVC/14.15.26726/atlmfc/include/afxwin.h:#include "afxrendertarget.h"
Binary file Enterprise/VC/Tools/MSVC/14.15.26726/atlmfc/lib/x64/afxnmcd.amd64.pdb matches
Binary file Enterprise/VC/Tools/MSVC/14.15.26726/atlmfc/lib/x64/afxnmcd.lib matches
Binary file Enterprise/VC/Tools/MSVC/14.15.26726/atlmfc/lib/x64/afxnmcdd.amd64.pdb matches
Binary file Enterprise/VC/Tools/MSVC/14.15.26726/atlmfc/lib/x64/afxnmcdd.lib matches
Binary file Enterprise/VC/Tools/MSVC/14.15.26726/atlmfc/lib/x64/mfcs140.amd64.pdb matches
Binary file Enterprise/VC/Tools/MSVC/14.15.26726/atlmfc/lib/x64/mfcs140.lib matches
Binary file Enterprise/VC/Tools/MSVC/14.15.26726/atlmfc/lib/x64/mfcs140d.amd64.pdb matches
Binary file Enterprise/VC/Tools/MSVC/14.15.26726/atlmfc/lib/x64/mfcs140d.lib matches
Binary file Enterprise/VC/Tools/MSVC/14.15.26726/atlmfc/lib/x64/mfcs140u.amd64.pdb matches
Binary file Enterprise/VC/Tools/MSVC/14.15.26726/atlmfc/lib/x64/mfcs140u.lib matches
Binary file Enterprise/VC/Tools/MSVC/14.15.26726/atlmfc/lib/x64/mfcs140ud.amd64.pdb matches
Binary file Enterprise/VC/Tools/MSVC/14.15.26726/atlmfc/lib/x64/mfcs140ud.lib matches
Binary file Enterprise/VC/Tools/MSVC/14.15.26726/atlmfc/lib/x64/nafxcw.amd64.pdb matches
Binary file Enterprise/VC/Tools/MSVC/14.15.26726/atlmfc/lib/x64/nafxcw.lib matches
Binary file Enterprise/VC/Tools/MSVC/14.15.26726/atlmfc/lib/x64/nafxcwd.amd64.pdb matches
Binary file Enterprise/VC/Tools/MSVC/14.15.26726/atlmfc/lib/x64/nafxcwd.lib matches
Binary file Enterprise/VC/Tools/MSVC/14.15.26726/atlmfc/lib/x64/uafxcw.amd64.pdb matches
Binary file Enterprise/VC/Tools/MSVC/14.15.26726/atlmfc/lib/x64/uafxcw.lib matches
Binary file Enterprise/VC/Tools/MSVC/14.15.26726/atlmfc/lib/x64/uafxcwd.amd64.pdb matches
Binary file Enterprise/VC/Tools/MSVC/14.15.26726/atlmfc/lib/x64/uafxcwd.lib matches
Binary file Enterprise/VC/Tools/MSVC/14.15.26726/atlmfc/lib/x86/afxnmcd.i386.pdb matches
Binary file Enterprise/VC/Tools/MSVC/14.15.26726/atlmfc/lib/x86/afxnmcd.lib matches
Binary file Enterprise/VC/Tools/MSVC/14.15.26726/atlmfc/lib/x86/afxnmcdd.i386.pdb matches
Binary file Enterprise/VC/Tools/MSVC/14.15.26726/atlmfc/lib/x86/afxnmcdd.lib matches
Binary file Enterprise/VC/Tools/MSVC/14.15.26726/atlmfc/lib/x86/mfcs140.i386.pdb matches
Binary file Enterprise/VC/Tools/MSVC/14.15.26726/atlmfc/lib/x86/mfcs140.lib matches
Binary file Enterprise/VC/Tools/MSVC/14.15.26726/atlmfc/lib/x86/mfcs140d.i386.pdb matches
Binary file Enterprise/VC/Tools/MSVC/14.15.26726/atlmfc/lib/x86/mfcs140d.lib matches
Binary file Enterprise/VC/Tools/MSVC/14.15.26726/atlmfc/lib/x86/mfcs140u.i386.pdb matches
Binary file Enterprise/VC/Tools/MSVC/14.15.26726/atlmfc/lib/x86/mfcs140u.lib matches
Binary file Enterprise/VC/Tools/MSVC/14.15.26726/atlmfc/lib/x86/mfcs140ud.i386.pdb matches
Binary file Enterprise/VC/Tools/MSVC/14.15.26726/atlmfc/lib/x86/mfcs140ud.lib matches
Binary file Enterprise/VC/Tools/MSVC/14.15.26726/atlmfc/lib/x86/nafxcw.i386.pdb matches
Binary file Enterprise/VC/Tools/MSVC/14.15.26726/atlmfc/lib/x86/nafxcw.lib matches
Binary file Enterprise/VC/Tools/MSVC/14.15.26726/atlmfc/lib/x86/nafxcwd.i386.pdb matches
Binary file Enterprise/VC/Tools/MSVC/14.15.26726/atlmfc/lib/x86/nafxcwd.lib matches
Binary file Enterprise/VC/Tools/MSVC/14.15.26726/atlmfc/lib/x86/uafxcw.i386.pdb matches
Binary file Enterprise/VC/Tools/MSVC/14.15.26726/atlmfc/lib/x86/uafxcw.lib matches
Binary file Enterprise/VC/Tools/MSVC/14.15.26726/atlmfc/lib/x86/uafxcwd.i386.pdb matches
Binary file Enterprise/VC/Tools/MSVC/14.15.26726/atlmfc/lib/x86/uafxcwd.lib matches
Enterprise/VC/Tools/MSVC/14.15.26726/atlmfc/src/mfc/afxrendertarget.cpp:#include "afxrendertarget.h"
Enterprise/VC/Tools/MSVC/14.15.26726/atlmfc/src/mfc/appui3.cpp:#include "afxrendertarget.h"
Enterprise/VC/Tools/MSVC/14.15.26726/atlmfc/src/mfc/wincore.cpp:#include "afxrendertarget.h"
grep: Professional/Common7/IDE/Blend.exe.config: Permission denied
No, not files that mention the file named afxrendertarget.h The actual file named afxrendertarget.h
fsshl@alice /cygdrive/c/Program Files (x86)
$ find . | grep afxrendertarget.h
find: ‘./Google/CrashReports’: Permission denied
./Microsoft Visual Studio/2017/Enterprise/VC/Tools/MSVC/14.15.26726/atlmfc/include/afxrendertarget.h
------------------------------------------------------------

In this file, the lines with beginning as "class"
are the following:


-------------------------------------------
class CBitmapRenderTarget;

----
class CD2DPointF : public D2D1_POINT_2F

-------------
class CD2DPointU : public D2D1_POINT_2U

-------------
class CD2DSizeF : public D2D1_SIZE_F

--------------
class CD2DSizeU : public D2D1_SIZE_U

-------------
class CD2DRectF : public D2D1_RECT_F

--------------

class CD2DRectU : public D2D1_RECT_U

---------------
class CD2DRoundedRect : public D2D1_ROUNDED_RECT

-----------------
class CD2DEllipse : public D2D1_ELLIPSE

-----------------
class CD2DResource : public CObject

-----------------------

class CD2DLayer : public CD2DResource

-----------------------
class CD2DBitmap : public CD2DResource

----------------
class CD2DBrushProperties : public D2D1_BRUSH_PROPERTIES

------------
class CD2DBrush : public CD2DResource

-------------

class CD2DSolidColorBrush : public CD2DBrush

-----------
class CD2DBitmapBrush : public CD2DBrush

--------

class CD2DGradientBrush : public CD2DBrush

----------
class CD2DLinearGradientBrush : public CD2DGradientBrush

-------
class CD2DRadialGradientBrush : public CD2DGradientBrush

-----------
class CD2DTextFormat : public CD2DResource

-------------
class CD2DTextLayout : public CD2DResource

----------
class CD2DGeometry : public CD2DResource

----------
class CD2DPathGeometry : public CD2DGeometry

---------

class CD2DGeometrySink

---------------------
class CD2DMesh : public CD2DResource

--------------------

class CRenderTarget : public CObject

----------------

class CHwndRenderTarget : public CRenderTarget

-------------------

class CDCRenderTarget : public CRenderTarget

--------

class CBitmapRenderTarget : public CRenderTarget

------------------

class _AFX_D2D_STATE : public CNoTrackObject

---------

actually when I build/compile, there are many errors , many related with these class name,
CD2D, in addition to as (type incomplete is no allowed)

hope to see any advanced help again soon






























The original error message suggested that the incomplete class was on line 348.
closed account (1vRz3TCk)
maypai37, what steps did you take to setup the project? Code3A.h and Code3A.cpp are fairly useless on their own.

Edit:
Found the book online, could follow the instructions with VS2010 but not with VS2017... I think I'm now where you are...

My guess at the moment (Haven't used MFC for a while) is that Microsoft have changed/added to the graphic subsystem. The code from the book looks like it is expecting GDI and VS2017 looks like it is using Direct2D.
Last edited on
348 CD2DResource(CRenderTarget* pParentTarget, BOOL bAutoDestroy);

-------------
please help for what's wrong about that. (really, this is Microsoft programmer's job, not mine)

---------------------
I choose .net frame work at vc++

then Empty project

then
I just type in everything as book listed(in my previous post)

in my 2017 visual studio enterprise.

---------------
I will try to find web, whether is/are good book/ref to learn vc++ graphic through visual studio 2017; in addition to old book I use or tested now.

so, if you have good resource, would you please to share some to me?
closed account (1vRz3TCk)
I think if you can find the recipe for creating a skeletal MFC app, you might be fine with that book. If I get time, I'll have a look and try to workout what the bare minimum version currently is...unless there is someone here who can shed some light.

As for good resources...I usually start with Microsoft documentation...can be hard work but the info is usually there.
https://docs.microsoft.com/en-us/windows/

I haven't seen a good book on programming Windows with C++ for many a year, I haven't been looking too hard.
Topic archived. No new replies allowed.