Results 1 to 3 of 3

Thread: Assertion failed when converting a std::string to std::basic_string<TCHAR> in debug

  1. #1
    Join Date
    Nov 2010
    Posts
    4
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Assertion failed when converting a std::string to std::basic_string<TCHAR> in debug

    The code is as follow:

    std::basic_string<TCHAR> dest;
    std::string source;

    source = makesource(); //return a std::string value

    #ifdef QT_DLL
    dest = QString(source.c_str()).toStdWString(); //debug assertion failed here
    #endif

    When I build the project in release mode, everything is OK, but when I build in debug mode, the program crashed at the second line from the bottom.

    Any suggestion will be appreciated.
    Thank you for your time.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,589
    Thanks
    13
    Thanked 1,585 Times in 1,514 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Assertion failed when converting a std::string to std::basic_string<TCHAR> in deb

    It would help if you told us what the error message was and where the assert statement was. It would also help if you completely rebuilt your project to make sure this is not a mismatched binaries issue.

  3. #3
    Join Date
    Nov 2010
    Posts
    4
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Assertion failed when converting a std::string to std::basic_string<TCHAR> in deb

    Thanks ChrisW67 for your reply.

    I gave up this one by redefining all the variables using std::string
    My project is closed to the deadlines though.

    Thanks for your time.

Similar Threads

  1. [perl] converting a string
    By mickey in forum General Programming
    Replies: 5
    Last Post: 26th March 2009, 14:33
  2. "Debug Assertion failed" in debug mode
    By hed in forum Qt Programming
    Replies: 10
    Last Post: 4th February 2008, 13:10
  3. Debug Assertion Failed
    By ^NyAw^ in forum General Programming
    Replies: 5
    Last Post: 28th December 2007, 12:48
  4. Converting number to string.
    By safknw in forum Newbie
    Replies: 2
    Last Post: 18th September 2006, 13:12
  5. ASSERT(Failed assertion in Qt == Qt bug)
    By 0xBulbizarre in forum Qt Programming
    Replies: 1
    Last Post: 20th March 2006, 20:06

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.