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. Book example build failed for Qt 4.7.3

Book example build failed for Qt 4.7.3

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 3.0k Views 1 Watching
  • 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.
  • K Offline
    K Offline
    kathy
    wrote on last edited by
    #1

    I have download the code for book "Advanced Qt Programming" written by Mark Summerfield.

    I use QtCreator 2.2.1 to open the .pro and try to build it using VC 2008 (Qt SDK 1.1.2) and got build error:
    @'cos': is not a member of 'std'@
    in file "datetimedelegate.cpp":
    @#ifdef MSVC_COMPILER
    const qreal x = length * cos(angle);
    const qreal y = length * sin(angle);
    #else
    const qreal x = length * std::cos(angle);
    const qreal y = length * std::sin(angle);
    #endif@
    Why? I have checked the project property and it said it is:
    Qt 4.7.3 for Desktop - MSVC2008(Qt SDK)

    1 Reply Last reply
    0
    • G Offline
      G Offline
      goetz
      wrote on last edited by
      #2

      You might want to include "QtCore/qmath.h":http://developer.qt.nokia.com/doc/qt-4.7/qtcore-qmath-h.html and use qSin() and qCos() instead:

      @
      #include <QtCore/qmath.h>

      const qreal x = length * qSin(angle);
      const qreal y = length * qCos(angle);
      @

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      0
      • K Offline
        K Offline
        kathy
        wrote on last edited by
        #3

        Does anyone have build the book source code successfully using Qt SDK 4.7.3 (Qt Creator 2.2.1)?

        1 Reply Last reply
        0
        • EddyE Offline
          EddyE Offline
          Eddy
          wrote on last edited by
          #4

          I did succesfully use the pagedesigner2 project. Which project are you interested in? I can give that a try.

          I'm using Qt Creator 2.2.1 also but based on Qt 4.7.4 (32 bit)
          i can build for 4.7.3 and also 4.8.(project settings)

          I think your problem is probably with msvc2008 and path settings. But I'm using mingw so i can't be of much assistance in your case.

          Qt Certified Specialist
          www.edalsolutions.be

          1 Reply Last reply
          0
          • K Offline
            K Offline
            kathy
            wrote on last edited by
            #5

            several projects like:
            Folderview
            petridish1
            petridish2

            Yes, It comes from:
            #ifdef MSVC_COMPILER
            it looks like MSVC_COMPILER is not defined.

            and using MinGW build OK.

            I fixed it by add:

            #include <cmath>

            to all files contain "MSVC_COMPILER"

            BUT, still, I can not build the project "textedit" by using VC 2008

            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