[Closed] Error in first SDK try
Hi,
I just installed Visual Studio 2005, and SDK in Max8. I was trying the basic IntervalArray example in the Max SDK help. When i compile the code according to the procedure specified I get a list of errors (8 errors) as shown in the image attached. A possible reason could be that in the Properties of the project in the Linker/Input “Additinal Dependencies” I cannot include/link it to maxscrpt.lib. (I have also created an image for this). I copied the maxsxrpt.lib to the “C:\Program Files\Microsoft Visual Studio 8\VC\lib” folder too.
This is the first time I’m trying SDK so my query might be inappropriate, so I’m not sure if I’ve forgotten to mention anything specific.
Thanks for any help,
Regards,
Vikram.
hi Vicki,
If you are compiling intervalarray from howto folder you not have to set anything. It will automatically find the lib file and includes file location because they are relative path.
————- Sdk folder Location —————–
Project File Location:
C:\Program Files\Autodesk\3ds Max 9 SDK\maxsdk\howto\maxscript\intervalarray
Lib file Location:
C:\Program Files\Autodesk\3ds Max 9 SDK\maxsdk\lib
Include File Location:
C:\Program Files\Autodesk\3ds Max 9 SDK\maxsdk\include
—————- Liker Settings(General) ——————-
Additional dependecy:
,…\lib,…\lib,…\maxsdk\lib,
Output File:(Change it to your 3dsmax plugin folder)
…\plugin\IntervalArray.dlx
————– C/C++ Setting (General) ————-
Additional Include Files :
.\midl\Win32;…\include; …\include\maxscrpt
If you are running the interval array from different project folder location, then you can hard code the lib and include files location (Absolute Path)
Example:
C:\Program Files\Autodesk\3ds Max 9 SDK\maxsdk\include
or
C:\Program Files\Autodesk\3ds Max 9 SDK\maxsdk\lib
There is another way to do it…set an environment variable to your max sdk folder, then use that variable to set other path
Example:
$(MAXSDK)\lib
$(MAXSDK)\include
It will help you in future to compile your project from different location.
Cheers
This is false.
You can build Max 8 plugins with Visual Studio 2005 but this is not recommended by Autodesk… I had no problem doing that. You have just to modify several lines in some header files to be compatible with Visual Studio 2005 compiler requirements.
Hey Sushanta,
Nice to hear from you, Thans a lot for the well explained help. I havent tried yet but will do now, and hey Thanks Kees for the version error. I was trying it in Max8,
Regards,
Vikram.
I need to warn others as well that the spacing in the DLLMain.cpp when copied from the help system alters some spacing that apparently breaks the code. Compare:
DLLMain.cpp as copied from the source file under howto:
BOOL WINAPI DllMain(HINSTANCE DLLhinst, DWORD fdwReason, LPVOID lpvReserved)
compared to copied text:
BOOL WINAPIDllMain(HINSTANCEDLL hinst, DWORDfdwReason, LPVOIDlpvReserved)
Edit:
Additional differences in file provided under howto versus what the help tells you:
- Help tells you under C/C++/General/Additional Include Directories to add the include/maxscrpt. This is true, however other header files are referenced and so you must add the /include such the dialog looks like
[pathing]\include
[pathing]\include\maxscrpt
- IntervalArray.def from source:
LIBRARY IntervalArray.dlx
EXPORTS
LibDescription @1 PRIVATE
LibInit @2 PRIVATE
LibVersion @3 PRIVATE
SECTIONS
.data READ WRITE
Note the .dlx is missing from the help files instructions, leading to a warning about differences in the exp file upon building the solution.
When you try building a Max 8 plugin with VS 2005 you'll get some compile errors in several header files.
In fact you will get 2 errors:
"maxsdk\include\imtl.h(1523) : error C2065: 'i' : undeclared identifier"
=> for this one declare 'i' before the loop. The assert was testing 'i' outside its scope !!?... Compiled with Visual Studio prior to version 2005...
Change the code of the method like this :
int i = 0;
for( ; i < nUserIllumOut; ++i ){
DbgAssert( userIllumNames );
if( _tcscmp( name, userIllumNames[i] )== 0){
userIllumOut[i] = out;
break;
}
}
DbgAssert( i < nUserIllumOut );
"maxsdk\include\polyobj.h(109) : error C2228: left of '.GetFlag' must have class/struct/union"
=> similar problem to the first compile error
Change the code like this :
numFaces = 0;
numVerts = 0;
int i = 0;
for (; i<mm.numf; i++) if (!mm.f[i].GetFlag (MN_DEAD)) numFaces++;
for (i=0; i<mm.numv; i++) if (!mm.v[i].GetFlag (MN_DEAD)) numVerts++;
return TRUE;
Here are the errors to fix.
I had no bug when I built and ran Max 8 plugins with VS 2005. But this is not recommended by Autodesk. And official plugins must be compiled with the appropriate Visual Studio version.
Hope this help.
interesting topic! I started my first mxs extension plugin too. I opened a topic on sparks about it, but it has so few traffic that I better try it here too.
(btw. I am using VS 2003 and it works after handling those space issues, too.
If you donwload the newest SDK you will also see the cpp files in the HOWTO dir, that might be a better source instead to copy form the help files.)
My question, if you don’t mind me hijacking this thread:
I want to return a String value from the MXS function, I am trying like this
one_typed_value_local(String* rString); vl.rString = new String ("foo");
But the compiler complains:
"error C2514: 'String' : class has no constructors" "\3ds max 8\maxsdk\include\maxscrpt\maxscrpt.h(49) : see declaration of 'String'"
In the docs the page ““Collector-Safe Value Local Macros” says that this should work, as they have similar code as example in regards of the String constructor.
Any hints?
thx
Dom
Yes, we don’t need it anymore (I’ve never used it). It’s now in the Deprecated topics of the SDK Documentation…