Qt World Summit: Submit your Presentation

Issues while building a project on Windows XP

  • Hi All,

    I've recently moved my actively developing simple Qt application from Linux platform to Windows. The build/run was smooth enough on Linux. I just wanted to experiment the cross-platform-ness on Windows too. Thats why I decided to move the project to Windows XP. But when building the code I see something like in the below image.

    !http://farm8.staticflickr.com/7029/6461115925_9d41a62149_b.jpg(Build Issue on Windows XP)!

    I Googled around and I got "this thread":http://stackoverflow.com/questions/3445312/swprintf-and-vswprintf-not-declared from Stackoverflow. The second answer from that thread fixed my problem. I commented out two of the lines in cwchar and everything works fine. But I'm just curios enough to know what was wrong with those two lines. Or is there any other 'legal' work around to fix the same?

    Thanks & Regards

  • The link to your image is broken.

  • I've just fixed it Eddy. Thanks

  • The solution to this problem was to comment out the two lines in the header files which contains vsprintf and wvsprintf. A normal comment from IRC channels on this issue was : "Just comment it out dude, its just buggy headers..." :)

  • If you really need it, Qt provides some printf compatible methods in a platform independent manner:

    • "qvsnprintf() ":/doc/qt-4.8/qbytearray.html#qvsnprintf
    • "qsnprintf() ":/doc/qt-4.8/qbytearray.html#qsnprintf
    • "QString::sprintf() ":/doc/qt-4.8/qstring.html#sprintf

    Alternatively, you should consider using [[Doc:QString]]'s arg() methods.

Log in to reply