error: invalid conversion from 'int' to 'const wchar_t*'

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.
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: error: invalid conversion from 'int' to 'const wchar_t*'

Post by CuteAlien »

Well, only one define left to check:

Code: Select all

 
#include "irrlicht.h"
#ifdef __WIN32_WCE
trying to compile for Windows CE?
#endif
 
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Cube_
Posts: 1010
Joined: Mon Oct 24, 2011 10:03 pm
Location: 0x45 61 72 74 68 2c 20 69 6e 20 74 68 65 20 73 6f 6c 20 73 79 73 74 65 6d

Re: error: invalid conversion from 'int' to 'const wchar_t*'

Post by Cube_ »

compiled just fine......
"this is not the bottleneck you are looking for"
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: error: invalid conversion from 'int' to 'const wchar_t*'

Post by CuteAlien »

Sorry, something makes no sense again.
When I told you to manually add: "#define swprintf swprintf_s" below the includes you got a new error that swprintf_s is not declared. So that obviously meant that this define which is also in irrTypes.h was not compiled there. But when checking now every single define which could prevent that from being compiled every one of them is correct. Which means it must be compiled.

I'm really running out of ideas - either that define does not work (then we would check your includes next) or it is not even compiled (but then one of the defines must be broken).

Hm ok - lets try what VS thinks you have: Go over "swprintf" in your main.cpp, right-click it and select "go to declaration". In which file and on which line will that bring you?
My guess is it will bring you to some define - then check again the same for the define - for example if there is swprintf_s then check for that. If VS offers you more than one solution (resolve ambiguity) then please write down all of them - again the the linenumber and the file (including path if possible, that can be somewhat telling in this case).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Cube_
Posts: 1010
Joined: Mon Oct 24, 2011 10:03 pm
Location: 0x45 61 72 74 68 2c 20 69 6e 20 74 68 65 20 73 6f 6c 20 73 79 73 74 65 6d

Re: error: invalid conversion from 'int' to 'const wchar_t*'

Post by Cube_ »

swprintf mentioned here:
11 (q3factory.cpp)#define swprintf swprintf_s

here:
98 (irrTypes.cpp)#define swprintf swprintf_s

here:
85 (swprintf.inl)extern "C++" _SWPRINTFS_DEPRECATED _CRT_INSECURE_DEPRECATE(swprintf_s) __inline int swprintf(_Pre_notnull_ _Post_z_ wchar_t * _String, _In_z_ _Printf_format_string_ const wchar_t * _Format, ...)

and here:
36 (swprintf.inl)static __inline int swprintf(wchar_t * _String, size_t _Count, const wchar_t * _Format, ...)


swprintf_s mentioned here:
466 (stdio.h)_CRTIMP_ALTERNATIVE int __cdecl swprintf_s(_Out_z_cap_(_SizeInWords) wchar_t * _Dst, _In_ size_t _SizeInWords, _In_z_ _Printf_format_string_ const wchar_t * _Format, ...);

and here:
468 (stdio.h)__DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_1_ARGLIST(int, swprintf_s, vswprintf_s, wchar_t, _Dest, _In_z_ _Printf_format_string_ const wchar_t *, _Format)
"this is not the bottleneck you are looking for"
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: error: invalid conversion from 'int' to 'const wchar_t*'

Post by CuteAlien »

Ok, so it is using the right define in irrTypes.h - no idea why you get different results by putting the same define again in the .cpp file, but out of ideas about that now. Just kick it out again from q3factory.cpp (I thought it was in main anyway.. but also doesn't matter anymore).

When you right-click the tab-name (stdio.h) in VS you can do "Copy full path" to find out which stdio.h is used in case you have more than one on your system and it finds the wrong one. The correct one should have a path similar to "Microsoft Visual Studio 9.0\VC\include\stdio.h".

Also when you are over stdio.h line 465 and you go over __STDC_WANT_SECURE_LIB__ - does it show you that it has values 1?

Lastly when did you get the swprintf.inl files? I don't get those when looking for "go to declaration" - which is the first time our systems seem to have some difference. Please also check the path of those. Because that one in line 85 is the wrong one which should not be used.

edit: also something simple I forgot asking: Which build-target are you using? I'm on Debug - Win32 so far - maybe it only happens with another one.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Cube_
Posts: 1010
Joined: Mon Oct 24, 2011 10:03 pm
Location: 0x45 61 72 74 68 2c 20 69 6e 20 74 68 65 20 73 6f 6c 20 73 79 73 74 65 6d

Re: error: invalid conversion from 'int' to 'const wchar_t*'

Post by Cube_ »

debug win32 atm.....

the swprintf.inl is int he include dir. (VC9 dir/include, don't have it on gcc tho)

465 stdio.h (only got one on the system :D) yes, it has a value of 1
"this is not the bottleneck you are looking for"
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: error: invalid conversion from 'int' to 'const wchar_t*'

Post by CuteAlien »

Yeah, I have the file - I just don't get an .inl file when going to declarations. That's why I'm wondering when you are getting that.

But I have no more ideas... from all I can see so far it is using the correct function-declaration - the one with a size_t as second parameter (size_t is an integer). But then you would not get the error. And that you get it with codeblocks as well is even more confusing.

Anyone else got any more ideas?

Clean everything recompile everything maybe.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Cube_
Posts: 1010
Joined: Mon Oct 24, 2011 10:03 pm
Location: 0x45 61 72 74 68 2c 20 69 6e 20 74 68 65 20 73 6f 6c 20 73 79 73 74 65 6d

Re: error: invalid conversion from 'int' to 'const wchar_t*'

Post by Cube_ »

tried, tried on the other computer (fresh install of gcc and codeblocks)

just opened the tutorial checked the linker settings and compiled....

same errors.
"this is not the bottleneck you are looking for"
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: error: invalid conversion from 'int' to 'const wchar_t*'

Post by CuteAlien »

Ok, I can reproduce it in codeblocks... in all versions - wtf...
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Cube_
Posts: 1010
Joined: Mon Oct 24, 2011 10:03 pm
Location: 0x45 61 72 74 68 2c 20 69 6e 20 74 68 65 20 73 6f 6c 20 73 79 73 74 65 6d

Re: error: invalid conversion from 'int' to 'const wchar_t*'

Post by Cube_ »

indeed.

confusing errors, rite?
"this is not the bottleneck you are looking for"
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: error: invalid conversion from 'int' to 'const wchar_t*'

Post by CuteAlien »

Well - not really if it uses wrong function declaration. The problem is that it seems to use the correct one in VS (and I have VS here as well and it works) and you still get an error. And even more confusing me now is that I can no longer compile examples in Codeblocks - not even for old versions. And not even a game where I used the same which was developed in Codeblocks on Windows... but I can't remember when I last changed anything on MinGW. But definitely not working with current MinGW it seems.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Cube_
Posts: 1010
Joined: Mon Oct 24, 2011 10:03 pm
Location: 0x45 61 72 74 68 2c 20 69 6e 20 74 68 65 20 73 6f 6c 20 73 79 73 74 65 6d

Re: error: invalid conversion from 'int' to 'const wchar_t*'

Post by Cube_ »

apparently....
so, I should revert to an older MinGW version maybe?
"this is not the bottleneck you are looking for"
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: error: invalid conversion from 'int' to 'const wchar_t*'

Post by CuteAlien »

No, the problem here is that driverChoice.h does include iostream (which it shouldn't in Irrlicht) which resets the swprintf and breaks it.
But in this case it does work here the way I wrote first - adding "#define swprintf swprintf_s" after the includes. Then I can compile in C::B as well.
Don't know yet why iostream does mess with this - maybe I find a way to prevent that (would surprise me if I never used those in combination).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: error: invalid conversion from 'int' to 'const wchar_t*'

Post by hybrid »

Well, the driver choice was deliberately written with iostream - after all it was always that way in the examples. But it shouldn't be included in irrlicht.h
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: error: invalid conversion from 'int' to 'const wchar_t*'

Post by CuteAlien »

Yeah - old examples 21 without driverChoice.h also fails. I wonder if I maybe haven't compiled it since I updated to MinGW 4.4.0.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Post Reply