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.
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_ »

ok....

I can't see any solution, if I use this:
#define swprintf swprintf_s
I get errors about swprintf not being declared in that scope
and without it the same errors...

how frustrating.


EDIT:

Somehow redefining it into
#define swprintf _snwprintf

helped a lot, now I just need to fix glitches I produced

Code: Select all

C:\FPRPG\main.cpp||In member function 'void Q3Player::create(irr::IrrlichtDevice*, irr::scene::IQ3LevelMesh*, irr::scene::ISceneNode*, irr::scene::IMetaTriangleSelector*)':|
C:\FPRPG\main.cpp|291|warning: unused variable 'driver'|
C:\FPRPG\main.cpp||In member function 'void Q3Player::respawn()':|
C:\FPRPG\main.cpp|388|warning: operation on '((Q3Player*)this)->Q3Player::StartPositionCurrent' may be undefined|
C:\FPRPG\main.cpp||In member function 'virtual bool CQuake3EventHandler::OnEvent(const irr::SEvent&)':|
C:\FPRPG\main.cpp|1300|error: 'loadMap' was not declared in this scope|
C:\FPRPG\main.cpp|1451|error: expected '}' before 'else'|
C:\FPRPG\main.cpp|1459|error: expected unqualified-id before 'if'|
C:\FPRPG\main.cpp|1462|error: expected unqualified-id before 'if'|
C:\FPRPG\main.cpp|1473|error: expected declaration before '}' token|
||=== Build finished: 5 errors, 2 warnings ===|
 
but, should be fairly easy to fix :D
well, except the loadMap thingy....
"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 »

aaammmsterdddam wrote:ok....

I can't see any solution, if I use this:
#define swprintf swprintf_s
I get errors about swprintf not being declared in that scope
and without it the same errors...

how frustrating.
Do you mean errors about swprintf_s not being declared? (sorry - but you have to be exact when it's about errors - that are 2 different problems). _snwprintf should be declared in stdio.h - so try including that first (but remember - do that after all the other includes in main.cpp). Although once more not needed here for me ... but could be we don't have same MinGW headers.

I'm still trying to figure out if we can avoid that in any way, but doesn't look too good so far. But one thing is interesting - I suspect rather that you also compiled Irrlicht itself by now - at least when doing a clean rebuild in VS, but maybe also in Code::blocks. And Irrlicht itself couldn't compile if it wouldn't find a correct swprintf version on your system.

The problem I have here is that so far it seems that if I want to use swprintf again later on after including anything from MinGW I will be forced to add those defines once more.

edit: Please check something in CodeBlocks. Do you have any entries in Settings - Compiler and Debugger - Search Directories?
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_ »

interesting...

well, managed to do some kind of workaround...

any idea why the win32-gcc precompiled irrlicht dll doesn't have any of the d3d drivers compiled into it?
"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 »

Please don't mix problems in same thread - that one is hard enough ;-) (I think it is a copyright-license problem)
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_ »

oh ok, so I would have to recompile it myself to use them?

anyway, back to topic...

so the workaround is mentioned in the first post on this page....
still don't fully get the problem...
"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 »

edit: Sorry, didn't see the fix you mentioned :-) And yeah - that is the define for MinGW, the other one was for VisualStudio. I did that automatically here and forgot telling you trying that, sorry.

The problem in my MinGW version is that the official workaround (defining __STRICT_ANSI__ first) is broken in that version (it breaks other headers) which seems to be a bug in MinGW (although rather old, not sure if my version is really that old..). The other workaround I have is ugly (re-adding those defines in main.cpp once more) - so will try updating MinGW first, but might take a while until I find time for this (this affects more projects for me, so updating that isn't a thing I can do so easy).
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_ »

so, I, myself, figured out how to correctly do it in MinGW?
^^
yay!
"this is not the bottleneck you are looking for"
Post Reply