Qt World Summit: Register Today!

Disabling warnings

  • Hey all,
    does somone know how to disable all kinds of warnings from selected file.

    Many thanks

  • What warnings? What files? What is generating the warnings?

  • welcome to devnet

    as ChrisW67 already indicates you need to give more details.

    When compiling Qt libs on your own you are typically facing a lot of warnings. However, those might be annoying, but they are harmless. As long as the compilation does not end with an error message.

    Unfortunately, some of Qt headers cause warnings in your code and they are dependent on the compiler and its version. You need to consult the documentation on how to actually switch them off.

  • Hey,
    the problem is with BasicExcel library which I use in my app. It's generates a lot of basic warnings like unsigned/signed int comparison and thus that I have to seek for my own problems in the sea of warings.

    Basically I try to keep my app without warinings at all thus this situation is a bit annoying for me :)

    What I'm looking for is any possibilty to tell compiler to not to show any warnigs during compiltion this library.

    Any ideas ?
    Maybe somone knows some other free cpp library which allows to read form xls and xlsx files ?

    Will be grateful for any help.

  • How is any one supposed to know that you are using a non Qt lib and which one ? ;-)

    There are other possibilities discussed here in the forum. You might want to check out "excel tag":https://qt-project.org/search/tag/excel but others like active X may be helpful as well.

  • Ok, thanks, but u still don't understand my question.

    Am I able to turn off the all kinds of warnings for selected file and not for all compilation process?

    Many thanks

  • You probably have to use #pragma statements in your source for switching off these warnings.
    However, those pragmas are dependent on your compiler. This is the only way for single source files AFAIK.
    Since you are compiling a library you may want to put the whole lib source into a separate project. You can have also your main application in a separate project. Using the "subdirs template":http://qt-project.org/doc/qt-5/qmake-variable-reference.html#subdirs with qmake allows you to choose different compiler switches for individual projects.
    On the other hand if you have different projects, you might not be bothered so much with warnings for the lib source itself.
    However, when the headers of the lib are causing the warnings in your application you are back to pragmas.

  • Thanks.
    I use VS a bit and pragma/override/seald and e.t.c are stricly connected with windows compiler.

    I will check those excel tags about which You posted before. Maybe it allows me to abandon this shity library :)

    Thanks for Your help

Log in to reply