none
有关于C2664的错误 RRS feed

  • 问题

  •  

    我用的是VS2005 Express版本,并安装了windows platform SDK for windows server 2003 R2,源程序如下:

    #include "Ogre.h"
    #include "stdafx.h"
    #include "ExampleApplication.h"

    class TutorialApplication : public ExampleApplication
    {
    protected:
    public:
        TutorialApplication()
        {
        }

        ~TutorialApplication()
        {
        }
    protected:
        void createScene(void)
        {
        }
    };

    #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
    #define WIN32_LEAN_AND_MEAN
    #include "windows.h"

    INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT )
    #else
    int main(int argc, char **argv)
    #endif
    {
        // Create application object
        TutorialApplication app;

        try {
            app.go();
        } catch( Exception& e ) {
    #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
            MessageBox( NULL, e.getFullDescription().c_str(), "An exception has occured!", MB_OK | MB_ICONERROR | MB_TASKMODAL);
    #else
            fprintf(stderr, "An exception has occured: %s\n",
                    e.getFullDescription().c_str());
    #endif
        }

        return 0;
    }

    编译后出现

    uments and settings\xjd\my documents\visual studio 2005\projects\test\test\test.cpp(38) : error C2664: 'MessageBoxW' : cannot convert parameter 3 from 'const char ×' to 'LPCWSTR'
    1>        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast

    的错误,我想请教一下该如何解决,谢谢各位。

    2008年7月16日 7:29

答案

全部回复