Results 1 to 4 of 4

Thread: How to avoid "warning: deprecated conversion from"?

  1. #1
    Join Date
    Mar 2006
    Posts
    142
    Thanks
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default How to avoid "warning: deprecated conversion from"?

    These warnings were supposed not to appear using:
    Qt Code:
    1. QMAKE_CXXFLAGS_DEBUG += -Wno-deprecated
    2. QMAKE_CXXFLAGS_RELEASE += -Wno-deprecated
    To copy to clipboard, switch view to plain text mode 
    but it does not work with the recent release of Qt.
    How to avoid all these deprecated warnings?

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

    Default Re: How to avoid "warning: deprecated conversion from"?

    How to avoid all these deprecated warnings?
    Fix your code so that it no longer uses deprecated features.

    Since you don't give us an example of the actual warning you are receiving or the actual code that generates it we have to guess.

    Warnings that you are receiving may be the result of the GCC g++ option:
    `-Wwrite-strings'
    When compiling C, give string constants the type `const
    char[LENGTH]' so that copying the address of one into a
    non-`const' `char *' pointer will get a warning. These warnings
    will help you find at compile time code that can try to write into
    a string constant, but only if you have been very careful about
    using `const' in declarations and prototypes. Otherwise, it will
    just be a nuisance. This is why we did not make `-Wall' request
    these warnings.

    When compiling C++, warn about the deprecated conversion from
    string literals to `char *'. This warning is enabled by default
    for C++ programs.
    The option:
    `-Wno-deprecated'
    Do not warn about usage of deprecated features. *Note Deprecated
    Features::.
    turns off a range of warnings about features that pre-date the C++ standard and were experimental in nature.

    Try placing these into:
    Qt Code:
    1. QMAKE_CFLAGS_WARN_ON += -Wno-write-string
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How to avoid "warning: deprecated conversion from"?

    Oops, that should be:
    Qt Code:
    1. # only be used if the warn_on option is set in CONFIG
    2. QMAKE_CXXFLAGS_WARN_ON += -Wno-write-strings
    3.  
    4. # Used all the time
    5. QMAKE_CXXFLAGS += -Wno-write-strings
    To copy to clipboard, switch view to plain text mode 

  4. #4
    Join Date
    Mar 2006
    Posts
    142
    Thanks
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How to avoid "warning: deprecated conversion from"?

    Thanks for your help!

Similar Threads

  1. Replies: 7
    Last Post: 8th November 2012, 11:26
  2. "unknown editor" warning message from XP
    By fragolan in forum Installation and Deployment
    Replies: 2
    Last Post: 6th April 2010, 11:33
  3. Replies: 5
    Last Post: 19th April 2009, 13:24
  4. Replies: 1
    Last Post: 10th March 2008, 17:51
  5. Translation QFileDialog standart buttons ("Open"/"Save"/"Cancel")
    By victor.yacovlev in forum Qt Programming
    Replies: 4
    Last Post: 24th January 2008, 19:05

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.