Hi there!
I am new to maxsdk, but already completed multiple input-output plugins (like our own gltf exporter in C++).
I prefer adding further integration to our plugins via menu items in the main menu so I changed architecture to create a *.gup instead of *.dli and add a single button on GUP plugin start that would run a maxscript command I am reading from a file near the plugin.
The problem is that I cannot instantiate a GUP plugin class because of the following linker errors:
1>------ Build started: Project: SDPlugin, Configuration: Debug x64 ------
1>cl : Command line warning D9025: overriding '/permissive-' with '/permissive'
1>dllmain.cpp
1> Creating library C:\MagosIT\Autodesk\SpaceDesigner\impex\SDPlugin\x64\Debug\sdplugin.lib and object C:\MagosIT\Autodesk\SpaceDesigner\impex\SDPlugin\x64\Debug\sdplugin.exp
1>dllmain.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl GUP::GUP(void)" (__imp_??0GUP@@QEAA@XZ) referenced in function "public: __cdecl MaxScriptSdGui::MaxScriptSdGui(void)" (??0MaxScriptSdGui@@QEAA@XZ)
1>dllmain.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __cdecl GUP::~GUP(void)" (__imp_??1GUP@@UEAA@XZ) referenced in function "int `public: __cdecl MaxScriptSdGui::MaxScriptSdGui(void)'::`1'::dtor$0" (?dtor$0@?0???0MaxScriptSdGui@@QEAA@XZ@4HA)
1>dllmain.obj : error LNK2001: unresolved external symbol "public: virtual class BitmapManager * __cdecl GUP::Bmi(void)" (?Bmi@GUP@@UEAAPEAVBitmapManager@@XZ)
1>dllmain.obj : error LNK2001: unresolved external symbol "public: virtual unsigned __int64 __cdecl GUP::Control(unsigned long)" (?Control@GUP@@UEAA_KK@Z)
1>dllmain.obj : error LNK2001: unresolved external symbol "public: virtual int __cdecl GUP::EnumTree(class ITreeEnumProc *)" (?EnumTree@GUP@@UEAAHPEAVITreeEnumProc@@@Z)
1>dllmain.obj : error LNK2001: unresolved external symbol "public: virtual bool __cdecl GUP::ExecuteFileScript(wchar_t const *)" (?ExecuteFileScript@GUP@@UEAA_NPEB_W@Z)
1>dllmain.obj : error LNK2001: unresolved external symbol "public: virtual bool __cdecl GUP::ExecuteStringScript(wchar_t const *)" (?ExecuteStringScript@GUP@@UEAA_NPEB_W@Z)
1>dllmain.obj : error LNK2001: unresolved external symbol "public: virtual enum IOResult __cdecl GUP::Load(class ILoad *)" (?Load@GUP@@UEAA?AW4IOResult@@PEAVILoad@@@Z)
1>dllmain.obj : error LNK2001: unresolved external symbol "public: virtual class Interface * __cdecl GUP::Max(void)" (?Max@GUP@@UEAAPEAVInterface@@XZ)
1>dllmain.obj : error LNK2001: unresolved external symbol "public: virtual class DllDir * __cdecl GUP::MaxDllDir(void)" (?MaxDllDir@GUP@@UEAAPEAVDllDir@@XZ)
1>dllmain.obj : error LNK2001: unresolved external symbol "public: virtual struct HINSTANCE__ * __cdecl GUP::MaxInst(void)" (?MaxInst@GUP@@UEAAPEAUHINSTANCE__@@XZ)
1>dllmain.obj : error LNK2001: unresolved external symbol "public: virtual struct HWND__ * __cdecl GUP::MaxWnd(void)" (?MaxWnd@GUP@@UEAAPEAUHWND__@@XZ)
1>dllmain.obj : error LNK2001: unresolved external symbol "public: virtual enum IOResult __cdecl GUP::Save(class ISave *)" (?Save@GUP@@UEAA?AW4IOResult@@PEAVISave@@@Z)
1>C:\MagosIT\Autodesk\SpaceDesigner\impex\SDPlugin\x64\Debug\sdplugin.gup : fatal error LNK1120: 13 unresolved externals
1>Done building project "SDPlugin.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========
I am using classes and functions from the SDK already and they work so I have no idea why they the linker does not find these.
This is my additional includes directory:
<IncludePath>..\..\..\maxsdk\include;$(IncludePath)</IncludePath>
<LibraryPath>..\..\..\maxsdk\lib\x64\Release;$(LibraryPath)</LibraryPath>
- with the given paths of course existing and containing the 2020 MaxSDK. I also see a file there called gup.lib that seems to be maybe what should contain these functions?
If I comment out the instantiation of the gup plugin class, I can build my app and earlier import-export plugins still work and build.
I return a class for gup as usual from the class desc:
void* Create(BOOL /*loading = FALSE*/) override {
//FIXME:return new MaxScriptSdGui();
return nullptr;
}
^^only return nullptr now so that the project builds.
The plugin class is this:
class MaxScriptSdGui : public GUP, ActionCallback, DynamicMenuCallback { ..... }
Likely I can drop ActionCallback now as it became a DynamicMenuCallback if needed, but I see no problem with that being there.
The documentation of the “missing” functions are like this:
/*! \remarks Implemented by the System.\n\n
This method will execute the specified MAXScript file.
\par Parameters:
<b>MCHAR *file</b>\n\n
The file name for the script file.
\return TRUE indicates if the script was successfully sent to
MAXScript; FALSE if it was not sent. Note that this does not reflect
the result of the script. */
GUPExport virtual bool ExecuteFileScript ( const MCHAR *file );
- so I think the implementation should be there for these functions indeed. What do I do wrong?!
Opening the gup.lib file I see that for exemple this ExecuteFileScript (and others) are listed there.
Further information
- I only have maxsdk and max2020 - not other products.
- v141
- 10.0.17763.0
- My project was NOT made using the project wizards (I was unable to make them work at all) - but everything linked / worked until now
- Windows 10, x64, VS2017 as usual. 3dsmax and maxsdk version is both 2020 version.
Original goal:
- My aim is to put out a simple menu, that runs a maxscript contained in the plugin package itself which contains a more complicated GUI that interfaces with the C++ plugin parts when needed. For this is why I started using GUP as it supposedly runs at startup and sounds like a good place to create a single (“connect to server”) menu button for running the script and building GUI.
- I am open to alternatives to what I am doing currently, but I want this to happen automatically on startup with no “installers” or other things that would “install” maxscript GUI elements or such. I cannot believe it is so hard to put up a simple menu item
Any help is appreciated.
Richard - MagosIT
PS.: If I cannot make this work in a *.gup plugin. Is there an other way to do similar startup-gui-additions in a *.dli kind plugin that contains SceneImport and SceneExport plugin classes? I am not really sure of how life-cycle is for import/export plugins but I know that I can likely force my DLL to not “auto defer” and maybe then there would be some workaround to do operations at startup, but I still prefer to know a proper solution as *.gup sounds to be what I need instead of these hackz… just open to any suggestions…