This is a brief guide for configuring Visual Studio to build 32 and 64-bit Maya plugins.
In Visual Studio, create a new Win32 project. Specify DLL as the Application type and tick Empty project in Additional options.
Add a source file (i.e. main.cpp). This file can be empty for the time being. Its purpose right now is just to add the C/C++ configuration section to the project’s Property Pages.
Right-click on the project in the Solution Explorer and select Properties, bringing-up the Property Pages window. Change Configuration to All Configurations so that our changes affect both the debug and release builds.
Apply the following settings:
For developing a 64-bit project, a few extra settings are needed:
Example projects can be found in: [path_to_maya]…\Autodesk\Maya[version]\devkit\plug-ins
I suggest navigating to this folder and examining these examples, starting with helloWorldCmd. Build helloWorldCmd.mll and then add it to the Plug-in Manager in Maya (Window > Settings/Preferences > Plug-in Manager > Browse). Invoking helloWorld in the MEL command-line should print “Hello World.”
For convenience’s sake, I have supplied Autodesk’s helloWorldCmd source code. It can be copy-and-pasted into the source file we created earlier:
// Copyright 1995,2006,2008 Autodesk, Inc. All rights reserved.
DeclareSimpleCommand(helloWorld, PLUGIN_COMPANY, "4.5");
MStatus helloWorld::doIt(const MArgList&)
cout << "Hello World" << endl;
For a faster setup, an example project can be repurposed into a template, or Maya’s setup wizard can be used. A lot of people (myself included) simply cannot get the setup wizard to work, which is why I mention it as an afterthought.
If you have any problems, feel free to leave a comment below.