(C++) Error when uncommenting RHINO_SDK_MFC

Hello,

When compiling a new Visual Studio C++ solution for Rhino plug-in (with latest tools from C++ Guides page), I need to uncomment the definition RHINO_SDK_MFC

// If you want to use Rhino's MFC UI classes, then
// uncomment the #define RHINO_SDK_MFC statement below. 
// Note, doing so will require that your plug-in is
// built with the same version of Visual Studio as was
// used to build Rhino.
#define RHINO_SDK_MFC

When doing so and compiling, I get these errors:

1>------ Build started: Project: Rhino3DMesh, Configuration: Debug x64 ------
1>stdafx.cpp
1> --- rhinoSDK.h --- Building Release Rhino plug-in
1> --- rhinoSDK.h --- Using Visual Studio compiler tools.
1> --- rhinoSDK.h --- Using Windows Platform SDK (MFC 14.x).
1>C:\Program Files\Rhino 8 SDK\inc\rhinoSdkUiLayerListCtrl.h(39,1): error C2504: 'CListCtrl': base class undefined
1>C:\Program Files\Rhino 8 SDK\inc\RhinoSdkUiSliderCtrl.h(24,1): error C2504: 'CSliderCtrl': base class undefined
1>C:\Program Files\Rhino 8 SDK\inc\RhinoSdkUiListBoxEx.h(25,1): error C2504: 'CDragListBox': base class undefined
1>C:\Program Files\Rhino 8 SDK\inc\RhinoSdkUiListBoxEx.h(154,16): error C2079: 'CRhinoUiListBoxExBuddy::m_ToolTip' uses undefined class 'CToolTipCtrl'
1>C:\Program Files\Rhino 8 SDK\inc\RhinoSdkUiProgressCtrl.h(22,1): error C2504: 'CProgressCtrl': base class undefined
1>C:\Program Files\Rhino 8 SDK\inc\RhinoSdkUiRichEditCtrl.h(22,1): error C2504: 'CRichEditCtrl': base class undefined
1>C:\Program Files\Rhino 8 SDK\inc\RhinoSdkUiGridListHeaderCtrl.h(22,1): error C2504: 'CHeaderCtrl': base class undefined
1>C:\Program Files\Rhino 8 SDK\inc\RhinoSdkUiGridListHeaderCtrl.h(39,13): error C2143: syntax error: missing ';' before '*'
1>C:\Program Files\Rhino 8 SDK\inc\RhinoSdkUiGridListHeaderCtrl.h(39,13): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files\Rhino 8 SDK\inc\RhinoSdkUiGridListHeaderCtrl.h(39,24): error C2238: unexpected token(s) preceding ';'
1>C:\Program Files\Rhino 8 SDK\inc\RhinoSdkUiGridListCtrl.h(22,1): error C2504: 'CListCtrl': base class undefined
1>C:\Program Files\Rhino 8 SDK\inc\RhinoSdkUiEdit.h(527,18): error C2143: syntax error: missing ';' before '*'
1>C:\Program Files\Rhino 8 SDK\inc\RhinoSdkUiEdit.h(527,18): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files\Rhino 8 SDK\inc\RhinoSdkUiEdit.h(527,45): error C2238: unexpected token(s) preceding ';'
1>C:\Program Files\Rhino 8 SDK\inc\RhinoSdkUiDialog.h(474,16): error C2079: 'CRhinoUiDialog::m_tool_tip' uses undefined class 'CToolTipCtrl'
1>C:\Program Files\Rhino 8 SDK\inc\RhinoSdkUiTabCtrl.h(22,1): error C2504: 'CTabCtrl': base class undefined
1>C:\Program Files\Rhino 8 SDK\inc\RhinoSdkUiLineTypeListCtrl.h(36,1): error C2504: 'CListCtrl': base class undefined
1>C:\Program Files\Rhino 8 SDK\inc\RhinoSdkUiPrintWidthListCtrl.h(21,1): error C2504: 'CListCtrl': base class undefined
1> --- Rhino C++ component links with libs in "C:/Program Files/Rhino 8 SDK/Lib/Release"
1>Done building project "Rhino3DMesh.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Do you know how to fix this? @dale do you know?

Thank you,
Pablo

Hi @pagarcia,

Make sure you add whatever MFC headers you need. Here’s what’s typical:

stdafx.zip (934 Bytes)

– Dale

Hi @dale , that fixed the issue :+1:

Thanks,
Pablo