err anyone reconize this: invalid convershion in CDemo.cpp

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
Siolis
Posts: 7
Joined: Mon Apr 11, 2005 2:17 pm

err anyone reconize this: invalid convershion in CDemo.cpp

Post by Siolis »

67 C:\Documents and Settings\Oliver\Desktop\C++ Work\Irrlicht Game Engine\irrlicht-0.9\examples\Demo\CDemo.cpp invalid conversion from `int' to `const wchar_t*'

Just trying to compile the demo in the tutorials so i can try and edit it however it wont compile due to the above error and i cant find anything which corrects it, it it a commen mistake which can be repared easily or what?

Siolis

PS: Im useing Dev-C++ 4.9.9.2 and all the other examples work fine.
hybrid

Re: err anyone reconize this: invalid convershion in CDemo.c

Post by hybrid »

Siolis wrote:67 C:\Documents and Settings\Oliver\Desktop\C++ Work\Irrlicht Game Engine\irrlicht-0.9\examples\Demo\CDemo.cpp invalid conversion from `int' to `const wchar_t*'
If you look at the code it's the following

Code: Select all

swprintf(tmp, 255, L"%s fps:%d", driver->getName(), driver->getFPS());
the error tells us that something's converted from int to wchar_t so it could be the case that you're missing the driver->getName() or something similar. This is the original code from version 0.8 so check yours if it fits.
Siolis
Posts: 7
Joined: Mon Apr 11, 2005 2:17 pm

Post by Siolis »

K ive got two comments to make:

Firstly ive found the function inside of IVideoDriver.h and:

virtual const wchar_t* getName() = 0;

to boot, i dont see how:

swprintf(tmp, 255, L"%s fps:%d", driver->getName(), driver->getFPS());

tries to send it an int, plus the help file says this function returns a pointer so...can anyone send me a working vershion of this dam engine or explain wtf is going on hear?

Im not an experienced programmer, im a designer with programing ability trying to build his own game so try to keep it simple please. :oops:

Siolis
hybrid

Post by hybrid »

Siolis wrote: swprintf(tmp, 255, L"%s fps:%d", driver->getName(), driver->getFPS());

tries to send it an int, plus the help file says this function returns a pointer so...can anyone send me a working vershion of this dam engine or explain wtf is going on hear?
I'm not sure if you meant this, but swprintf does not return a string, it returns the numbers of wide characters written to the string. So if you want to access the string afterwards you have to use tmp.
Electron
Posts: 874
Joined: Sun Mar 14, 2004 12:05 am
Location: Massachusetts USA

Post by Electron »

change the swprintf line to _snwprintf. It has to do with some typedefs Irrlicht makes, but this fixes it for MinGW
You do a lot of programming? Really? I try to get some in, but the debugging keeps me pretty busy.

Crucible of Stars
Siolis
Posts: 7
Joined: Mon Apr 11, 2005 2:17 pm

Post by Siolis »

[Linker error] undefined reference to `_imp__AdrOpenSound@12'
[Linker error] undefined reference to `_imp__AdrOpenSampleSource@8'
[Linker error] undefined reference to `_imp__AdrOpenSampleSource@8'
ld returned 1 exit status
C:\Documents and Settings\Oliver\Desktop\C++ Work\Irrlicht Game Engine\irrlicht-0.9\examples\Demo\Makefile.win [Build Error] [Demo.exe] Error 1

I think im gonna cry...

Siolis
mm765
Posts: 172
Joined: Fri May 28, 2004 10:12 am

Post by mm765 »

the demo uses audiere (audio lib)
hybrid

Post by hybrid »

Electron wrote:change the swprintf line to _snwprintf. It has to do with some typedefs Irrlicht makes, but this fixes it for MinGW
So MingW does not support the usual Linux interface? It seems to be a wide-char enhanced BSD function. Linux does not provide an swprintf without limiting the maximal output length, thus no need to change to a different function. Does anyone know which OS this routine comes from?
But it shouldn't be a problem with typedefs in Irrlicht, probably missing ifdefs though.
Electron
Posts: 874
Joined: Sun Mar 14, 2004 12:05 am
Location: Massachusetts USA

Post by Electron »

I really don't know what MinGW is doing. According to my std library reference, what Irrlicht is doing is in accordance with the swprintf function in cwchar. I just know that changing it to _snwprintf works, at least with an Irrlicht app
You do a lot of programming? Really? I try to get some in, but the debugging keeps me pretty busy.

Crucible of Stars
Post Reply