Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Exclude qmath.h from build

Exclude qmath.h from build

Scheduled Pinned Locked Moved Unsolved General and Desktop
13 Posts 4 Posters 1.7k Views
  • 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.
  • Christian EhrlicherC Christian Ehrlicher

    I can include math.h and qmath.h without getting any compiler warnings or errors here.
    What Qt-version and MSVC compiler do you use?

    This is working fine:

    #include <math.h>
    #include <qmath.h>
    
    int main(int argc, char** argv)
    {
    	return 0;
    }
    

    The order of the both includes also don't matter.

    gmk27G Offline
    gmk27G Offline
    gmk27
    wrote on last edited by
    #3

    @Christian-Ehrlicher MSVC2013. Qt creator 4.14.2 Qt 5.15.2
    the solution you suggested is tried already. That didn't work for me somehow.
    Let me try once again and confirm.

    Free softwares drives technology.

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by Christian Ehrlicher
      #4

      Qt5.15 can not be use with this ancient compiler: https://doc.qt.io/qt-5/supported-platforms.html

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      gmk27G 1 Reply Last reply
      3
      • gmk27G Offline
        gmk27G Offline
        gmk27
        wrote on last edited by
        #5

        oh okay that explains the problem I guess. I tried again. It didn't work. VS2019 is what you suggest right?

        Free softwares drives technology.

        1 Reply Last reply
        0
        • Christian EhrlicherC Christian Ehrlicher

          Qt5.15 can not be use with this ancient compiler: https://doc.qt.io/qt-5/supported-platforms.html

          gmk27G Offline
          gmk27G Offline
          gmk27
          wrote on last edited by
          #6

          @Christian-Ehrlicher said in Exclude qmath.h from build:

          Qt5.15 can not be use with this ancient compiler: https://doc.qt.io/qt-5/supported-platforms.html

          I have installed VS2019 now. With MSVC2013 I don't have errors. Now I have lot of errors with my previous warnings intact. It is between qmath.h and corecrt_math_defines.h. What could be the problem?

          Free softwares drives technology.

          J.HilkJ Christian EhrlicherC 2 Replies Last reply
          0
          • gmk27G gmk27

            @Christian-Ehrlicher said in Exclude qmath.h from build:

            Qt5.15 can not be use with this ancient compiler: https://doc.qt.io/qt-5/supported-platforms.html

            I have installed VS2019 now. With MSVC2013 I don't have errors. Now I have lot of errors with my previous warnings intact. It is between qmath.h and corecrt_math_defines.h. What could be the problem?

            J.HilkJ Offline
            J.HilkJ Offline
            J.Hilk
            Moderators
            wrote on last edited by
            #7

            @gmk27 can you post the actual wording of the errors?

            The new one and the original one, I had a math.h related problem recently and I'm wondering if it could be similar


            Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


            Q: What's that?
            A: It's blue light.
            Q: What does it do?
            A: It turns blue.

            gmk27G 1 Reply Last reply
            0
            • gmk27G gmk27

              @Christian-Ehrlicher said in Exclude qmath.h from build:

              Qt5.15 can not be use with this ancient compiler: https://doc.qt.io/qt-5/supported-platforms.html

              I have installed VS2019 now. With MSVC2013 I don't have errors. Now I have lot of errors with my previous warnings intact. It is between qmath.h and corecrt_math_defines.h. What could be the problem?

              Christian EhrlicherC Offline
              Christian EhrlicherC Offline
              Christian Ehrlicher
              Lifetime Qt Champion
              wrote on last edited by
              #8

              @gmk27 said in Exclude qmath.h from build:

              What could be the problem?

              You're still using the old compiler I would guess.

              Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
              Visit the Qt Academy at https://academy.qt.io/catalog

              gmk27G 1 Reply Last reply
              0
              • Christian EhrlicherC Christian Ehrlicher

                @gmk27 said in Exclude qmath.h from build:

                What could be the problem?

                You're still using the old compiler I would guess.

                gmk27G Offline
                gmk27G Offline
                gmk27
                wrote on last edited by gmk27
                #9

                @Christian-Ehrlicher No buddy. I have uninstalled VS2013 before installing the 2019 version. It is not even in the KITS, I checked everything.

                Free softwares drives technology.

                1 Reply Last reply
                0
                • J.HilkJ J.Hilk

                  @gmk27 can you post the actual wording of the errors?

                  The new one and the original one, I had a math.h related problem recently and I'm wondering if it could be similar

                  gmk27G Offline
                  gmk27G Offline
                  gmk27
                  wrote on last edited by
                  #10

                  @J-Hilk

                  C4005: M_E: Macro redefinition     -      corecrt_math_defines.h
                  see previous definition of M_E        -      qmath.h
                  

                  And so on with all M_* defines. I have included math.h before qmath.h as suggested.

                  Free softwares drives technology.

                  1 Reply Last reply
                  0
                  • Christian EhrlicherC Offline
                    Christian EhrlicherC Offline
                    Christian Ehrlicher
                    Lifetime Qt Champion
                    wrote on last edited by
                    #11

                    Please also make sure that not an old WinSDK is installed and used.
                    The corecrt_math_defines.h must contain something like this:

                    #ifndef _MATH_DEFINES_DEFINED
                        #define _MATH_DEFINES_DEFINED
                        // Definitions of useful mathematical constants
                        //
                        // Define _USE_MATH_DEFINES before including <math.h> to expose these macro
                        // definitions for common math constants.  These are placed under an #ifdef
                        // since these commonly-defined names are not part of the C or C++ standards
                    

                    qmath.h properly defines _USE_MATH_DEFINES (line 50)

                    Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                    Visit the Qt Academy at https://academy.qt.io/catalog

                    1 Reply Last reply
                    2
                    • gmk27G Offline
                      gmk27G Offline
                      gmk27
                      wrote on last edited by gmk27
                      #12

                      @Christian-Ehrlicher - Yes, I see there are proper guard checks in corecrt_math_defines.h. BTW I have Windows 10 SDK installed. I believe it is the latest one. I tried to reproduce the warnings by creating a new Qt project (as in your 1st reply to this post) but these warnings are not popped up, interestingly. Point to note is - these warnings are coming even if I don't include the <qmath.h> in my existing project. I have checked whole project it is nowhere included. In the new project it is just fine (with either files included or only one).

                      Where should I look exactly to fix this kind of issue?

                      Just to remind my platform - Qt 5.15 and MSVC2019 kit

                      Free softwares drives technology.

                      1 Reply Last reply
                      0
                      • VRoninV Offline
                        VRoninV Offline
                        VRonin
                        wrote on last edited by
                        #13

                        The only conflict I've ever seen in this real is related to min/max functions but it can be easily solved adding NOMINMAX to the preprocessor definitions.

                        "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
                        ~Napoleon Bonaparte

                        On a crusade to banish setIndexWidget() from the holy land of Qt

                        1 Reply Last reply
                        0

                        • Login

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved