MaxSDK GUP plugin linker errors

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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 in my project and those worked before and still works now 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 source-level 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.
((see attachment))
Further information
- This is purely C++ plugin so far
- I only have maxsdk and max2020 - not other products.
- PlatformToolset: v141
- WindowsTargetPlatformVersion: 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…
PS.: Instead of doing it the GOP way, I can maybe try to do it in my DLLs "LibInitialize()" but that sound like a really-really awful idea even if I would force to not use "auto defer" plugin loading... Maybe I can try running a script at that point using ExecuteMaxScriptScript that brings-in the file?
EDIT:
I get similar errors when I try to do an ExecuteMAXScriptScript(..) call:
__declspec( dllexport ) int LibInitialize() {
// TODO: Perform initialization here.
// FIXME: Remove test code to see if we can evaluate maxscript here or not
ExecuteMAXScriptScript(_T(R"(
try(DestroyDialog RL_Test)catch()
Rollout RL_Test "The Test Dialog"
(
button btn_ok "Ok"
on btn_ok pressed do
(
Destroydialog RL_Test
)
)
CreateDialog RL_Test
)"));
return TRUE;
}
See errors:
1>------ Build started: Project: SDPlugin, Configuration: Debug x64 ------
1>cl : Command line warning D9025: overriding '/permissive-' with '/permissive'
1>dllmain.cpp
1>c:\magosit\autodesk\spacedesigner\maxsdk\include\maxscript\macros\value_locals.h(487): warning C4535: calling _set_se_translator() requires /EHa
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) int __cdecl ExecuteMAXScriptScript(wchar_t const *,int,class FPValue *,int)" (__imp_?ExecuteMAXScriptScript@@YAHPEB_WHPEAVFPValue@@H@Z) referenced in function "int __cdecl LibInitialize(void)" (?LibInitialize@@YAHXZ)
1>dllmain.obj : error LNK2001: unresolved external symbol "struct HINSTANCE__ * hInstance" (?hInstance@@3PEAUHINSTANCE__@@EA)
1>C:\MagosIT\Autodesk\SpaceDesigner\impex\SDPlugin\x64\Debug\sdplugin.gup : fatal error LNK1120: 2 unresolved externals
1>Done building project "SDPlugin.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========
Is there something that is maybe in some extra libs while everything else is in the same file or what might be the problem?