helloWorldCmd fail to load in Maya

Hi.

I’m trying to learn C++ for Maya. After compiled helloWorldCmd.cpp that came with Maya 2012 devkit, I get this error when trying to load it.

// Error: initializePlugin function could not be found in plug-in (helloWorldCmd) // 

The comments in the code itself says

// This plugin uses DeclareSimpleCommand macro
// to do the necessary initialization for a simple command
// plugin with one argument.

So the DeclareSimpleCommand failed to do the initialization? Here’s the code without comments

#include <maya/MIOStream.h>
#include <maya/MSimple.h>

DeclareSimpleCommand( hello, PLUGIN_COMPANY, "4.5");

MStatus hello::doIt( const MArgList& args )
{

	cout<<"Hello "<<args.asString(0).asChar()<<endl;
	return MS::kSuccess;
}

I’m using Visual Studio 2010
Platform Toolset is set to Windows 7.1 SDK (had both 32 and 64 bit installed)
Maya 2012 Sp1 64 bit.

I thought it required Visual Studio 2008?

http://download.autodesk.com/global/docs/mayasdk2012/en_us/index.html?url=files/Setting_up_your_build_environment_Introduction_to_building_plugins_and_applications.htm,topicNumber=d28e13743

Since you are creating a dll, you need to give it an entry and exit point which is the initializePlugin and the uninitializePlugin… they are defined in declaresimple stuff(I guess, never used it) but you need to give it to VS as well.