Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

disable warning in c++

Tags:

c++

warnings

qt

I am new in c++. I am compiling a code source on Qt. I have this warning:

In file included from ../ListAllPrsilicaCameras/main.cpp:3: In file included from /usr/include/c++/4.2.1/backward/iostream.h:31: /usr/include/c++/4.2.1/backward/backward_warning.h:32:2: warning: This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the header for the header for C++ includes, or instead of the deprecated header . To disable this warning use -Wno-deprecated. [-W#warnings]

#warning This file includes at least one deprecated or antiquated header.

^ 1 warning generated


I got also these warning:

../ListCamerasProsilicaII/main.cpp:79:51: warning: unused parameter 'junk' [-Wunused-parameter]
void SetConsoleCtrlHandler(void (*func)(int), int junk)
                                                  ^
../ListCamerasProsilicaII/main.cpp:89:23: warning: unused parameter 'Signo' [-Wunused-parameter]
void CtrlCHandler(int Signo)
                      ^
../ListCamerasProsilicaII/main.cpp:140:57: warning: flag ' ' results in undefined behavior with 'u' conversion specifier [-Wformat]
                        printf("%s - %8s - Unique ID = % 8lu IP@ = %15s [%s]\n",cameraList[i].SerialString,
                                                       ~^~~~
../ListCamerasProsilicaII/main.cpp:147:57: warning: flag ' ' results in undefined behavior with 'u' conversion specifier [-Wformat]
clang++ -headerpad_max_install_names -mmacosx-version-min=10.6 -o ListCamerasProsilicaII main.o   -L/opt/local/lib/ -lPvAPI -lPvJNI -L/opt/local/lib -lJPEG -F/Users/rafikgouiaa/Qt//5.0.2/clang_64/lib -framework QtCore 
                        printf("%s - %8s - Unique ID = % 8lu (unavailable, %u)\n",cameraList[i].SerialString,
                                                       ~^~~~
../ListCamerasProsilicaII/main.cpp:152:53: warning: flag ' ' results in undefined behavior with 'u' conversion specifier [-Wformat]
                    printf("%s - %8s - Unique ID = % 8lu (*)\n",cameraList[i].SerialString,
                                                   ~^~~~
../ListCamerasProsilicaII/main.cpp:171:14: warning: unused parameter 'argc' [-Wunused-parameter]
int main(int argc, char* argv[])
             ^
../ListCamerasProsilicaII/main.cpp:171:26: warning: unused parameter 'argv' [-Wunused-parameter]
int main(int argc, char* argv[])
                         ^
7 warnings generated.

How can I disable this warning ?

like image 665
LearnToGrow Avatar asked Oct 15 '25 08:10

LearnToGrow


1 Answers

Repeating the previous answer "The answer is in the warning message itself."

"To disable this warning use -Wno-deprecated."

You can specify the compiler flag in the Qt project file (.pro) adding this line:

QMAKE_CXXFLAGS += -Wno-deprecated

P.S. It will be better to fix the code itself

like image 184
alexeibs Avatar answered Oct 16 '25 22:10

alexeibs



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!