Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    Disable visual studio warnings

    General and Desktop
    2
    2
    3057
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      santanaa last edited by

      We treat warnings as bugs and our policy is that our own code has to build cleanly, so I need to be able to spot warnings about my code. When I build our qt based project in visual studio 2010 I get literally 10s of thousands of warnings about Qt's code. This is fine, I just need a way to disable them. Wrapping all of our include of qt headers with specific pragmas is not desirable. Any one know how to globably tun of warnings for just qt headers??

      sample:
      @
      299>c:\qt\4.8.4\include\qtcore../../src/corelib/tools/qlist.h(409): warning C4127: conditional expression is constant
      299>c:\qt\4.8.4\include\qtcore../../src/corelib/tools/qlist.h(430): warning C4127: conditional expression is constant
      299> c:\qt\4.8.4\include\qtcore../../src/corelib/tools/qlist.h(429) : while compiling class template member function 'void QList<T>::node_destruct(QList<T>::Node *,QList<T>::Node *)'
      299> with
      299> [
      299> T=QList<QVariant>
      299> ]
      299> c:\qt\4.8.4\include\qtcore../../src/corelib/tools/qlist.h(707) : while compiling class template member function 'void QList<T>::detach_helper(int)'
      299> with
      299> [
      299> T=QList<QVariant>
      299> ]
      299> c:\qt\4.8.4\include\qtcore../../src/corelib/tools/qlist.h(730) : while compiling class template member function 'QList<T>::~QList(void)'
      299> with
      299> [
      299> T=QList<QVariant>
      299> ]
      299> c:\qt\4.8.4\include\qtcore../../src/corelib/kernel/qmetatype.h(196) : see reference to function template instantiation 'void *qMetaTypeConstructHelper<T>(const T *)' being compiled
      299> with
      299> [
      299> T=QList<QList<QVariant>>
      299> ]
      299> c:\users\burlen\paraview\next\paraview\qt\core\pqSMAdaptor.h(47) : see reference to function template instantiation 'int qRegisterMetaType<QList<T>>(const char *,QList<T> *)' being compiled
      299> with
      299> [
      299> T=QList<QVariant>
      299> ]
      @

      [code wrappings added "see":http://qt-project.org/wiki/ForumHelp#e3f82045ad0f480d3fb9e0ac2d58fb01 , koahnig]

      1 Reply Last reply Reply Quote 0
      • K
        koahnig last edited by

        welcome to devnet

        you can use the a pragma for disabling and enabling warnings.
        @
        #ifdef _MSC_VER
        #pragma warning ( disable : 4127 )
        #endif
        @

        You can also use "enable" to switch on the warnings.

        The "problem" is to locate the headers and embracing them with these pragmas.

        Vote the answer(s) that helped you to solve your issue(s)

        1 Reply Last reply Reply Quote 0
        • First post
          Last post