No instance of Constructor matches the argument list but argument list matches documentation and template code

  3dsmax, c++, constructor, sdk, visual-studio-2019

To start off, I am working with 3ds Max SDK. I don’t expect many people to have used this SDK but the issue itself is not SDK specific from what I can tell. I suspect this is a Visual Studio issue but I’m not sure how to fix.

Here is a section the code that is currently showing the error.

#include <actiontable.h>

namespace {
    const ActionTableId creatorToolActionTableId = 0x52510afc;  //1381042940
    const ActionContextId creatorToolActionContextId = 0x59b927b6;
}

// Setting up the Creator Tool ActionTable
class CreatorToolActionTable : public ActionTable {
public:
    CreatorToolActionTable()
        : ActionTable(creatorToolActionTableId, creatorToolActionContextId, TSTR(GetString(IDS_CT_CATEGORY)))
    {
        static ActionDescription ctActions[] = {
            //Creator Tool          1
            {
            ID_CREATOR_TOOL,
            IDS_CREATOR_TOOL_DESC,
            IDS_CREATOR_TOOL,
            IDS_CT_CATEGORY,
            },

            //Creator Tool Help     2
            {
            ID_CREATOR_TOOL_HELP,
            IDS_CREATOR_TOOL_HELP_DESC,
            IDS_CREATOR_TOOL_HELP,
            IDS_CT_CATEGORY
            }
        };
        BuildActionTable(nullptr, sizeof(ctActions) / sizeof(ctActions[0]), ctActions, hInstance);
    };
    ~CreatorToolActionTable() {};
    BOOL IsEnabled(int) override { return TRUE; };
    BOOL IsChecked(int) override { return FALSE; };
};

The error is showing at ActionTable(creatorToolActionTableId, creatorToolActionContextId, TSTR(GetString(IDS_CT_CATEGORY))).
The error is the same as the title that there is not a constructor for ActionTable::ActionTable matching the arguments (const ActionTableId, const ActionContextId, WStr).

When referring to the SDK documents and examples of code, there is maxMenuDemo which is my main reference for this. The section of code in maxMenuDemo.cpp is:

#include <actiontable.h>

namespace {
const ActionTableId kMenuDemoActionTableId = 0x44370c39;
const ActionContextId kMenuDemoActionContextId = 0x44370c3A;
}

class MenuDemoActionTable : public ActionTable
{
public:
    MenuDemoActionTable()
            : ActionTable(kMenuDemoActionTableId, kMenuDemoActionContextId, TSTR(GetString(IDS_AT_CATEGORY)))
    {
        // You can comment this out, if you want to load files from disk.
        RegisterDynamicResources(GetColorManager()->GetAppFrameColorTheme());

        // This packages up our actions into an ActionDescription for our ActionTable
        static ActionDescription spActions[] = { 
            ID_ACTION1, // ID
            IDS_ACTION1_DESC, // menu1
            IDS_ACTION1, 
            IDS_AT_CATEGORY,

            ID_ACTION2, 
            IDS_ACTION2_DESC, 
            IDS_ACTION2, 
            IDS_AT_CATEGORY };

        BuildActionTable(nullptr, sizeof(spActions) / sizeof(spActions[0]), spActions, hInstance);
    };

    ~MenuDemoActionTable()
    {
        UnregisterDynamicResources();
    };

    MaxIcon* GetIcon(int cmdId) override;
    BOOL IsChecked(int /*cmdId*/) override { return FALSE; };
    BOOL IsEnabled(int /*cmdId*/) override { return TRUE; };

    // Qt support for loading icon resources
    using Theme = IColorManager::AppFrameColorTheme;
    void RegisterDynamicResources(const Theme& theme = Theme::kDarkTheme);
    void UnregisterDynamicResources();

private:
    std::unique_ptr<MaxIcon> m_MaxIcons[2];
    // The registered path for the compiled icon bundles - see the maxMenuDemo.qrc 
    // files,  and the custom build tool on the file on how these .rcc files
    // are being generated.
    QString m_registeredRCCPath;
};

To me, the code is the exact same in terms of what is being input for CreatorToolActionTable : Actiontable(creatorToolActionTableId, creatorToolActionContextId, TSTR(GetString(IDS_CT_CATERGORY))) and for MenuDemoActionTable(): ActionTable(kMenuDemoActionTableId, kMenuDemoActionContextId, TSTR(GetString(IDS_AT_CATEGORY))). Therefore, I would assume it would work for my code and I should not have the error since the template code also does not have the error.

The only real differences between my code and the template is I have removed references to Qt and icons as I am not using them.

There are two constructors for ActionTable:
CoreExport ActionTable(ActionTableId id, ActionContextId contextId, MSTR& name) and
CoreExport ActionTable(ACtionTableId id, ActionContextId contextId, MSTR& name, HACCEL hDefaults, int numids, ActionDescription* pOps, HINSTANCE hInst)

I have tried using the second constructor as well on its own and received the same errors when the parameters matched the documentation.
Here is the link to the SDK documentation (specifically for ActionTable class): 3ds Max 2021 SDK

I am running this on VS2019 targeted for VS2015.

Is the issue with VS2019 or am I completely missing something?

Source: Windows Questions C++

LEAVE A COMMENT