PDA

View Full Version : How to avoid "warning: deprecated conversion from"?



Caius Aérobus
17th January 2011, 18:19
These warnings were supposed not to appear using:

QMAKE_CXXFLAGS_DEBUG += -Wno-deprecated
QMAKE_CXXFLAGS_RELEASE += -Wno-deprecated
but it does not work with the recent release of Qt.
How to avoid all these deprecated warnings?

ChrisW67
18th January 2011, 00:09
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:


QMAKE_CFLAGS_WARN_ON += -Wno-write-string

ChrisW67
18th January 2011, 06:27
Oops, that should be:


# only be used if the warn_on option is set in CONFIG
QMAKE_CXXFLAGS_WARN_ON += -Wno-write-strings

# Used all the time
QMAKE_CXXFLAGS += -Wno-write-strings

Caius Aérobus
18th January 2011, 16:11
Thanks for your help!