VicToMeyeZR Posted January 28, 2010 Share Posted January 28, 2010 Your LEO, Framework, c++ example complies with an error 1>.\Kattemaksu.cpp(13) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [29]' to 'LPCWSTR' 1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast 1>.\Kattemaksu.cpp(22) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [29]' to 'LPCWSTR' 1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast Quote AMD Phenom II x6 1100T - 16GB RAM - ATI 5870 HD - OCZ Vertex 2 60GB SSD Link to comment Share on other sites More sharing options...
Roland Posted January 28, 2010 Author Share Posted January 28, 2010 Your LEO, Framework, c++ example complies with an error 1>.\Kattemaksu.cpp(13) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [29]' to 'LPCWSTR' 1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast 1>.\Kattemaksu.cpp(22) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [29]' to 'LPCWSTR' 1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast I have noticed that also. Its fixed in my templates #include "leo.h" using namespace LEO ; #if defined( _WINDOWS ) void ErrOut( const char* pstrMessage ) { MessageBoxA(0, pstrMessage, "Error", 0 ); } int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd ) #else void ErrOut( const std::string& message ) { puts( message.c_str()); } int main( int argn, char* argv[] ) #endif { // Set graphics mode Engine engine("Example - LEO with Framework",1024,768); if( !engine.IsValid() ) { ErrOut( "Failed to set graphics mode."); return 1; } // Create framework object and set it to a global object so other scripts can access it Framework fw; fw.Create(); if( NULL == fw ) { ErrOut( "Failed to initialize engine." ); return 1; } // Set Lua framework object engine.SetObject( "fw", fw ); // Set Lua framework variable Lua lua; lua.Create(); lua.PushObject( fw ); lua.SetGlobal( "fw" ); lua.Pop( 1 ); // Get framework main camera fw.main.camera.SetPosition( Vec3(0,0,-2) ); Material material( "abstract::cobblestones.mat" ); Cube mesh( CREATENOW ); mesh.Paint( material ); Cube ground( CREATENOW ); ground.Scale( Vec3(10,1,10) ); ground.SetPosition( Vec3(0,-2,0) ); ground.Paint( material ); DirectionalLight light( CREATENOW ); light.SetRotation( Vec3(45) ); while( !engine.IsTerminated() ) { mesh.Turn( Vec3( AppSpeed()*0.5f ) ); fw.Update(); fw.Render(); engine.Flip( 0 ); } return engine.Free(); } Quote Roland Strålberg Website: https://rstralberg.com Link to comment Share on other sites More sharing options...
Canardia Posted January 28, 2010 Share Posted January 28, 2010 I think a better way to fix the MessageBox problem is to set character set: "not set" in the project properties. Else you run into the same problem with all other Windows functions too. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Roland Posted January 28, 2010 Author Share Posted January 28, 2010 I think a better way to fix the MessageBox problem is to set character set: "not set" in the project properties. Else you run into the same problem with all other Windows functions too. Yes. Thats will have same effect as MessageBoxA. So my the sample will then use MessageBox for Windows (compiled non-unicode) and puts for Console (I might in fact use std::cerr instead). Quote Roland Strålberg Website: https://rstralberg.com Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.