dimensio2d issue

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Massimo
Posts: 2
Joined: Sat Apr 09, 2016 3:40 pm

dimensio2d issue

Post by Massimo »

I have just started using Irrlicht, and just to try it out I copied the "Hello World" example exactly as the tutorial says.
After having finished copying, Visual Studio tells me there is this error:
no suitable user-defined conversion from "irr::core::dimension2d<irr::s32>" to "const irr::core::dimension2d<irr::u32>" exists
in this line:

Code: Select all

IrrlichtDevice* device = createDevice(EDT_SOFTWARE, dimension2d<s32>(512, 384), 16, false, false, false, 0);
I'm not so good with c++ (I'm studying to become better), but I tried to correct the code to:

Code: Select all

IrrlichtDevice* device = createDevice(EDT_SOFTWARE, const dimension2d<s32>(512, 384), 16, false, false, false, 0);
and then the error became:
no suitable user-defined conversion from "const irr::core::dimension2d<irr::s32>" to "const irr::core::dimension2d<irr::u32>" exists
So, it could be my inexperience wit c++, but I don't get where the error is, I mean, why would it need a conversion from "const dimension<s32>" to "const dimension<s32>"? :?
What am I missing?
Thank you in advance for helping me out :)
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: dimensio2d issue

Post by hendu »

Did you copy by hand? The 01-helloworld in 1.7.2 and later has dimension2d<u32>, like the error says.
Seven
Posts: 1034
Joined: Mon Nov 14, 2005 2:03 pm

Re: dimensio2d issue

Post by Seven »

error says : cannot convert from s32 to u32

change it from dimension2d<s32>(512, 384) to dimension2d<u32>(512, 384)

this structure is templated. when you create it, it uses whatever type you tell it to use
search templates and you will see

these are all different............
dimension2d<s32>(512, 384) s32 signed integer?
dimension2d<u32>(512, 384) u32 unsigned integer?
dimension2d<f32>(512, 384) f32 floating point
Massimo
Posts: 2
Joined: Sat Apr 09, 2016 3:40 pm

Re: dimensio2d issue

Post by Massimo »

using <u32> solves the problem! thank you very much!
Seven
Posts: 1034
Joined: Mon Nov 14, 2005 2:03 pm

Re: dimensio2d issue

Post by Seven »

not a fan of the title, but the content here is pretty good.....

http://www.codeproject.com/Articles/257 ... lates-Part
Post Reply