IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Qt Discussion :

problème de compilation


Sujet :

Qt

  1. #21
    Membre éprouvé

    Profil pro
    Inscrit en
    Mai 2007
    Messages
    774
    Détails du profil
    Informations personnelles :
    Âge : 37
    Localisation : France, Finistère (Bretagne)

    Informations forums :
    Inscription : Mai 2007
    Messages : 774
    Points : 969
    Points
    969
    Par défaut
    Salut,

    Déjà y a une erreur dans ton .pro "C::"

    Ensuite, perso j'ai pas mal utilisé Qwt, et ça a toujours marché chez moi. Si tu veux me filer ton code, je peux essayer de le compiler, car ça vient sûrement de là, vu tes erreurs.

    G.
    Un problème avec Qt ? Vous trouverez votre réponse ici : http://doc.trolltech.com/4.6/overviews.html
    En français (traduction réalisée par l'équipe Qt de DVP) : http://qt.developpez.com/doc/4.6/vues-d-ensemble/

  2. #22
    yan
    yan est déconnecté
    Rédacteur
    Avatar de yan
    Homme Profil pro
    Ingénieur expert
    Inscrit en
    Mars 2004
    Messages
    10 033
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Ille et Vilaine (Bretagne)

    Informations professionnelles :
    Activité : Ingénieur expert
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Mars 2004
    Messages : 10 033
    Points : 13 968
    Points
    13 968
    Par défaut
    ha oui je suis bête
    j'avais fait la même erreur avant les vacances ,
    sous windows, il faut spécifier que tu utilise qwt sous forme de dll.
    Il faut ajouter
    "DEFINES += QWT_DLL". dans le .pro
    Avant il fallait aussi le spécifier pour qt avec QT_DLL, mais il me semble que c'est obsolète maintenant.

    En gros, cela te permet d'hériter correctement des widget de qwt

  3. #23
    Candidat au Club
    Profil pro
    Inscrit en
    Janvier 2009
    Messages
    23
    Détails du profil
    Informations personnelles :
    Âge : 37
    Localisation : France

    Informations forums :
    Inscription : Janvier 2009
    Messages : 23
    Points : 2
    Points
    2
    Par défaut
    Bon alors je n'est pas creer le code ci-dessous, c'est un exemple de qwt pour faire un histogramme (je trouve que c'est bien compliqué quand même).

    Donc voici mon .cpp :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    #include <qstring.h>
    #include <qpainter.h>
    #include <qwt_plot.h>
    #include <qwt_interval_data.h>
    #include <qwt_painter.h>
    #include <qwt_scale_map.h>
    #include "histogramitem.h"
     
    class HistogramItem::PrivateData
    {
        public:
        int attributes;
        QwtIntervalData data;
        QColor color;
        double reference;
    };
     
    HistogramItem::HistogramItem(const QwtText &title):
        QwtPlotItem(title)
    {
        init();
    }
     
    HistogramItem::HistogramItem(const QString &title):
        QwtPlotItem(QwtText(title))
    {
        init();
    }
     
    HistogramItem::~HistogramItem()
    {
        delete d_data;
    }
     
    void HistogramItem::init()
    {
        d_data = new PrivateData();
        d_data->reference = 0.0;
        d_data->attributes = HistogramItem::Auto;
     
        setItemAttribute(QwtPlotItem::AutoScale, true);
        setItemAttribute(QwtPlotItem::Legend, true);
     
        setZ(20.0);
    }
     
    void HistogramItem::setBaseline(double reference)
    {
        if ( d_data->reference != reference )
        {
            d_data->reference = reference;
            itemChanged();
        }
    }
     
    double HistogramItem::baseline() const
    {
        return d_data->reference;
    }
     
    void HistogramItem::setData(const QwtIntervalData &data)
    {
        d_data->data = data;
        itemChanged();
    }
     
    const QwtIntervalData &HistogramItem::data() const
    {
        return d_data->data;
    }
     
    void HistogramItem::setColor(const QColor &color)
    {
        if ( d_data->color != color )
        {
            d_data->color = color;
            itemChanged();
        }
    }
     
    QColor HistogramItem::color() const
    {
        return d_data->color;
    }
     
    QwtDoubleRect HistogramItem::boundingRect() const
    {
        QwtDoubleRect rect = d_data->data.boundingRect();
        if ( !rect.isValid() )
            return rect;
     
        if ( d_data->attributes & Xfy )
        {
            rect = QwtDoubleRect( rect.y(), rect.x(),
                rect.height(), rect.width() );
     
            if ( rect.left() > d_data->reference )
                rect.setLeft( d_data->reference );
            else if ( rect.right() < d_data->reference )
                rect.setRight( d_data->reference );
        }
        else
        {
            if ( rect.bottom() < d_data->reference )
                rect.setBottom( d_data->reference );
            else if ( rect.top() > d_data->reference )
                rect.setTop( d_data->reference );
        }
     
        return rect;
    }
     
     
    int HistogramItem::rtti() const
    {
        return QwtPlotItem::Rtti_PlotHistogram;
    }
     
    void HistogramItem::setHistogramAttribute(HistogramAttribute attribute, bool on)
    {
        if ( bool(d_data->attributes & attribute) == on )
            return;
     
        if ( on )
            d_data->attributes |= attribute;
        else
            d_data->attributes &= ~attribute;
     
        itemChanged();
    }
     
    bool HistogramItem::testHistogramAttribute(HistogramAttribute attribute) const
    {
        return d_data->attributes & attribute;
    }
     
    void HistogramItem::draw(QPainter *painter, const QwtScaleMap &xMap,
        const QwtScaleMap &yMap, const QRect &) const
    {
        const QwtIntervalData &iData = d_data->data;
     
        painter->setPen(QPen(d_data->color));
     
        const int x0 = xMap.transform(baseline());
        const int y0 = yMap.transform(baseline());
     
        for ( int i = 0; i < (int)iData.size(); i++ )
        {
            if ( d_data->attributes & HistogramItem::Xfy )
            {
                const int x2 = xMap.transform(iData.value(i));
                if ( x2 == x0 )
                    continue;
     
                int y1 = yMap.transform( iData.interval(i).minValue());
                int y2 = yMap.transform( iData.interval(i).maxValue());
                if ( y1 > y2 )
                    qSwap(y1, y2);
     
                if ( i < (int)iData.size() - 2 )
                {
                    const int yy1 = yMap.transform(iData.interval(i+1).minValue());
                    const int yy2 = yMap.transform(iData.interval(i+1).maxValue());
     
                    if ( y2 == qwtMin(yy1, yy2) )
                    {
                        const int xx2 = xMap.transform(
                            iData.interval(i+1).minValue());
                        if ( xx2 != x0 && ( (xx2 < x0 && x2 < x0) ||
                                              (xx2 > x0 && x2 > x0) ) )
                        {
                           // One pixel distance between neighboured bars
                           y2++;
                        }
                    }
                }
     
                drawBar(painter, Qt::Horizontal,
                    QRect(x0, y1, x2 - x0, y2 - y1));
            }
            else
            {
                const int y2 = yMap.transform(iData.value(i));
                if ( y2 == y0 )
                    continue;
     
                int x1 = xMap.transform(iData.interval(i).minValue());
                int x2 = xMap.transform(iData.interval(i).maxValue());
                if ( x1 > x2 )
                    qSwap(x1, x2);
     
                if ( i < (int)iData.size() - 2 )
                {
                    const int xx1 = xMap.transform(iData.interval(i+1).minValue());
                    const int xx2 = xMap.transform(iData.interval(i+1).maxValue());
     
                    if ( x2 == qwtMin(xx1, xx2) )
                    {
                        const int yy2 = yMap.transform(iData.value(i+1));
                        if ( yy2 != y0 && ( (yy2 < y0 && y2 < y0) ||
                                        (yy2 > y0 && y2 > y0) ) )
                        {
                            // One pixel distance between neighboured bars
                            x2--;
                        }
                    }
                }
                drawBar(painter, Qt::Vertical,
                    QRect(x1, y0, x2 - x1, y2 - y0) );
            }
        }
    }
     
    void HistogramItem::drawBar(QPainter *painter,
       Qt::Orientation, const QRect& rect) const
    {
       painter->save();
     
       const QColor color(painter->pen().color());
    #if QT_VERSION >= 0x040000
       const QRect r = rect.normalized();
    #else
       const QRect r = rect.normalize();
    #endif
     
       const int factor = 125;
       const QColor light(color.light(factor));
       const QColor dark(color.dark(factor));
     
       painter->setBrush(color);
       painter->setPen(Qt::NoPen);
       QwtPainter::drawRect(painter, r.x() + 1, r.y() + 1,
          r.width() - 2, r.height() - 2);
       painter->setBrush(Qt::NoBrush);
     
       painter->setPen(QPen(light, 2));
    #if QT_VERSION >= 0x040000
       QwtPainter::drawLine(painter,
          r.left() + 1, r.top() + 2, r.right() + 1, r.top() + 2);
    #else
       QwtPainter::drawLine(painter,
          r.left(), r.top() + 2, r.right() + 1, r.top() + 2);
    #endif
     
       painter->setPen(QPen(dark, 2));
    #if QT_VERSION >= 0x040000
       QwtPainter::drawLine(painter,
          r.left() + 1, r.bottom(), r.right() + 1, r.bottom());
    #else
       QwtPainter::drawLine(painter,
          r.left(), r.bottom(), r.right() + 1, r.bottom());
    #endif
     
       painter->setPen(QPen(light, 1));
     
    #if QT_VERSION >= 0x040000
       QwtPainter::drawLine(painter,
          r.left(), r.top() + 1, r.left(), r.bottom());
       QwtPainter::drawLine(painter,
          r.left() + 1, r.top() + 2, r.left() + 1, r.bottom() - 1);
    #else
       QwtPainter::drawLine(painter,
          r.left(), r.top() + 1, r.left(), r.bottom() + 1);
       QwtPainter::drawLine(painter,
          r.left() + 1, r.top() + 2, r.left() + 1, r.bottom());
    #endif
     
       painter->setPen(QPen(dark, 1));
     
    #if QT_VERSION >= 0x040000
       QwtPainter::drawLine(painter,
          r.right() + 1, r.top() + 1, r.right() + 1, r.bottom());
       QwtPainter::drawLine(painter,
          r.right(), r.top() + 2, r.right(), r.bottom() - 1);
    #else
       QwtPainter::drawLine(painter,
          r.right() + 1, r.top() + 1, r.right() + 1, r.bottom() + 1);
       QwtPainter::drawLine(painter,
          r.right(), r.top() + 2, r.right(), r.bottom());
    #endif
     
       painter->restore();
    }
    Le .h :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
     * Qwt Widget Library
     * Copyright (C) 1997   Josef Wilgen
     * Copyright (C) 2002   Uwe Rathmann
     *
     * This library is free software; you can redistribute it and/or
     * modify it under the terms of the Qwt License, Version 1.0
     *****************************************************************************/
     
    #ifndef HISTOGRAMITEM_H
    #define HISTOGRAMITEM_H
     
    #include <qglobal.h>
    #include <qcolor.h>
     
    #include "qwt_plot_item.h"
     
    class QwtIntervalData;
    class QString;
     
    class HistogramItem: public QwtPlotItem
    {
        Q_OBJECT
     
        public:
        explicit HistogramItem(const QString &title = QString::null);
        explicit HistogramItem(const QwtText &title);
        virtual ~HistogramItem();
     
        void setData(const QwtIntervalData &data);
        const QwtIntervalData &data() const;
     
        void setColor(const QColor &);
        QColor color() const;
     
        virtual QwtDoubleRect boundingRect() const;
     
        virtual int rtti() const;
     
        virtual void draw(QPainter *, const QwtScaleMap &xMap,
            const QwtScaleMap &yMap, const QRect &) const;
     
        void setBaseline(double reference);
        double baseline() const;
     
        enum HistogramAttribute
        {
            Auto = 0,
            Xfy = 1
        };
     
        void setHistogramAttribute(HistogramAttribute, bool on = true);
        bool testHistogramAttribute(HistogramAttribute) const;
     
        protected:
        virtual void drawBar(QPainter *,Qt::Orientation o, const QRect &) const;
     
        private:
        void init();
     
        class PrivateData;
        PrivateData *d_data;
    };
     
    #endif
    et mon Main :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    #include <stdlib.h>
    #include <qapplication.h>
    #include <qpen.h>
    #include <qwt_plot.h>
    #include <qwt_plot_grid.h>
    #include <qwt_plot_marker.h>
    #include <qwt_interval_data.h>
    #include "histogramitem.h"
     
    int main(int argc, char **argv)
    {
        QApplication a(argc, argv);
     
        QwtPlot plot;
        plot.setCanvasBackground(QColor(Qt::white));
        plot.setTitle("Histogram");
     
        QwtPlotGrid *grid = new QwtPlotGrid;
        grid->enableXMin(true);
        grid->enableYMin(true);
        grid->setMajPen(QPen(Qt::black, 0, Qt::DotLine));
        grid->setMinPen(QPen(Qt::gray, 0 , Qt::DotLine));
        grid->attach(&plot);
     
        HistogramItem *histogram = new HistogramItem();
        histogram->setColor(Qt::darkCyan);
     
        const int numValues = 20;
     
        QwtArray<QwtDoubleInterval> intervals(numValues);
        QwtArray<double> values(numValues);
     
        double pos = 0.0;
        for ( int i = 0; i < (int)intervals.size(); i++ )
        {
            const int width = 5 + rand() % 15;
            const int value = rand() % 100;
     
            intervals[i] = QwtDoubleInterval(pos, pos + double(width));
            values[i] = value;
     
            pos += width;
        }
     
        histogram->setData(QwtIntervalData(intervals, values));
        histogram->attach(&plot);
     
        plot.setAxisScale(QwtPlot::yLeft, 0.0, 100.0);
        plot.setAxisScale(QwtPlot::xBottom, 0.0, pos);
        plot.replot();
     
    #if QT_VERSION < 0x040000
        a.setMainWidget(&plot);
    #endif
     
        plot.resize(600,400);
        plot.show();
     
        return a.exec();
    }
    si jamais vous avais un exemple plus simple et compréhensible se serais peut être mieux je sais pas...?

    En tout cas merci de me filé un gros coup de main

    Au fait mon .pro doit être comme ca??
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    ######################################################################
    # Automatically generated by qmake (2.01a) ven. 9. janv. 10:22:48 2009
    ######################################################################
     
    TEMPLATE = app
    TARGET = 
    DEPENDPATH += C:/Qt/qwt-5.1.1/lib
    INCLUDEPATH += C:/Qt/qwt-5.1.1/src
    LIBS += -LC/::/Qt/qwt-5.1.1/lib -lqwt5
    DEFINES += QWT_DLL
     
     
    # Input
    HEADERS += HistogramItem.h
    SOURCES += HistogramItem.cpp main.cpp
    je doit fair juste un qmake -> make ou bien refaire a chaque fois un qmake -project?

  4. #24
    Membre éprouvé

    Profil pro
    Inscrit en
    Mai 2007
    Messages
    774
    Détails du profil
    Informations personnelles :
    Âge : 37
    Localisation : France, Finistère (Bretagne)

    Informations forums :
    Inscription : Mai 2007
    Messages : 774
    Points : 969
    Points
    969
    Par défaut
    Il faut faire une seule fois qmake -project, puis modifier le .pro à la main.

    Pour DEFINES +=QWT_DLL, je n'ai jamais utilisé ça dans mes .pro, et Qwt fonctionne très bien ! Je ne suis pas sûr que ce soit la source du problème. As tu encore des problèmes de compilation ?

    G.
    Un problème avec Qt ? Vous trouverez votre réponse ici : http://doc.trolltech.com/4.6/overviews.html
    En français (traduction réalisée par l'équipe Qt de DVP) : http://qt.developpez.com/doc/4.6/vues-d-ensemble/

  5. #25
    Candidat au Club
    Profil pro
    Inscrit en
    Janvier 2009
    Messages
    23
    Détails du profil
    Informations personnelles :
    Âge : 37
    Localisation : France

    Informations forums :
    Inscription : Janvier 2009
    Messages : 23
    Points : 2
    Points
    2
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    C:\Documents and Settings\louise\Mes documents\TestGraphqueDemo>
    C:\Documents and Settings\louise\Mes documents\TestGraphqueDemo>make
    mingw32-make -f Makefile.Debug
    mingw32-make[1]: Entering directory `C:/Documents and Settings/louise/Mes docume
    nts/TestGraphqueDemo'
    g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -
    DQWT_DLL -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAI
    N -I"..\..\..\..\Qt\4.4.3\include\QtCore" -I"..\..\..\..\Qt\4.4.3\include\QtCore
    " -I"..\..\..\..\Qt\4.4.3\include\QtGui" -I"..\..\..\..\Qt\4.4.3\include\QtGui"
    -I"..\..\..\..\Qt\4.4.3\include" -I"..\..\..\..\Qt\qwt-5.1.1\src" -I"c:\Qt\4.4.3
    \include\ActiveQt" -I"debug" -I"." -I"..\..\..\..\Qt\4.4.3\mkspecs\win32-g++" -o
     debug\moc_HistogramItem.o debug\moc_HistogramItem.cpp
    debug\moc_HistogramItem.cpp:38: error: `staticMetaObject' is not a member of `Qw
    tPlotItem'
    debug\moc_HistogramItem.cpp: In member function `virtual void* HistogramItem::qt
    _metacast(const char*)':
    debug\moc_HistogramItem.cpp:52: error: `qt_metacast' is not a member of `QwtPlot
    Item'
    debug\moc_HistogramItem.cpp: In member function `virtual int HistogramItem::qt_m
    etacall(QMetaObject::Call, int, void**)':
    debug\moc_HistogramItem.cpp:57: error: `qt_metacall' is not a member of `QwtPlot
    Item'
    mingw32-make[1]: *** [debug/moc_HistogramItem.o] Error 1
    mingw32-make[1]: Leaving directory `C:/Documents and Settings/louise/Mes documen
    ts/TestGraphqueDemo'
    mingw32-make: *** [debug] Error 2
    et oui encore des erreurs mais il me dit que c des erreurs dans moc_HistogramItem

  6. #26
    yan
    yan est déconnecté
    Rédacteur
    Avatar de yan
    Homme Profil pro
    Ingénieur expert
    Inscrit en
    Mars 2004
    Messages
    10 033
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Ille et Vilaine (Bretagne)

    Informations professionnelles :
    Activité : Ingénieur expert
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Mars 2004
    Messages : 10 033
    Points : 13 968
    Points
    13 968
    Par défaut
    Citation Envoyé par Gulish Voir le message
    Pour DEFINES +=QWT_DLL, je n'ai jamais utilisé ça dans mes .pro, et Qwt fonctionne très bien ! Je ne suis pas sûr que ce soit la source du problème. As tu encore des problèmes de compilation ?

    G.
    debug\moc_HistogramItem.cpp:52: error: `qt_metacast' is not a member of `QwtPlotItem'
    je peut t'assurer que cela viens que DEFINES +=QWT_DLL n'est pas dans le .pro.

    C'est exactement le type d'erreur que j'ai eu après avoir modifie mon .pro pour qu'il fonctionne sous windows et linux.
    Normalement c'est spécifique windows.

  7. #27
    Membre éprouvé

    Profil pro
    Inscrit en
    Mai 2007
    Messages
    774
    Détails du profil
    Informations personnelles :
    Âge : 37
    Localisation : France, Finistère (Bretagne)

    Informations forums :
    Inscription : Mai 2007
    Messages : 774
    Points : 969
    Points
    969
    Par défaut
    Je viens d'essayer, DEFINES += QWT_DLL, ça ne compile pas. Pourtant tu as raison, l'erreur est dû au fait que le compilateur n'arrive pas à voir que QwtPlotItem étend QObject.

    Pour personn02, en attendant, tu peux régler le problème ainsi :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    class HistogramItem: public QObject, public QwtPlotItem 
    {
    ...
    }
    Change la déclaration de la class HistogramItem, en ajoutant "public QObject". Normalement, ça devrait marcher.

    G.
    Un problème avec Qt ? Vous trouverez votre réponse ici : http://doc.trolltech.com/4.6/overviews.html
    En français (traduction réalisée par l'équipe Qt de DVP) : http://qt.developpez.com/doc/4.6/vues-d-ensemble/

  8. #28
    yan
    yan est déconnecté
    Rédacteur
    Avatar de yan
    Homme Profil pro
    Ingénieur expert
    Inscrit en
    Mars 2004
    Messages
    10 033
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Ille et Vilaine (Bretagne)

    Informations professionnelles :
    Activité : Ingénieur expert
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Mars 2004
    Messages : 10 033
    Points : 13 968
    Points
    13 968
    Par défaut
    et avec DEFINES += QWT_DLL QT_DLL
    ? il me semblais que QT_DLL était obsolète.

  9. #29
    Candidat au Club
    Profil pro
    Inscrit en
    Janvier 2009
    Messages
    23
    Détails du profil
    Informations personnelles :
    Âge : 37
    Localisation : France

    Informations forums :
    Inscription : Janvier 2009
    Messages : 23
    Points : 2
    Points
    2
    Par défaut
    Ca ne marche pas,
    voici l'erreur (que je ne connais pas...)

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    C:\Documents and Settings\louise\Mes documents\TestGraphqueDemo>make
    mingw32-make -f Makefile.Debug
    mingw32-make[1]: Entering directory `C:/Documents and Settings/louise/Mes docume
    nts/TestGraphqueDemo'
    g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-rel
    oc -mthreads -Wl -Wl,-subsystem,windows -o debug\TestGraphqueDemo.exe debug/Hist
    ogramItem.o debug/main.o debug/moc_HistogramItem.o  -L"c:\Qt\4.4.3\lib" -lmingw3
    2 -lqtmaind -LC/::/Qt/qwt-5.1.1/lib -lqwt5 -lQtGuid4 -lQtCored4
    C:\MinGW\bin\..\lib\gcc\mingw32\3.4.2\..\..\..\..\mingw32\bin\ld.exe: cannot fin
    d -lqwt5
    collect2: ld returned 1 exit status
    mingw32-make[1]: *** [debug\TestGraphqueDemo.exe] Error 1
    mingw32-make[1]: Leaving directory `C:/Documents and Settings/louise/Mes documen
    ts/TestGraphqueDemo'
    mingw32-make: *** [debug] Error 2

  10. #30
    Membre éprouvé

    Profil pro
    Inscrit en
    Mai 2007
    Messages
    774
    Détails du profil
    Informations personnelles :
    Âge : 37
    Localisation : France, Finistère (Bretagne)

    Informations forums :
    Inscription : Mai 2007
    Messages : 774
    Points : 969
    Points
    969
    Par défaut
    C:\MinGW\bin\..\lib\gcc\mingw32\3.4.2\..\..\..\..\mingw32\bin\ld.exe: cannot find -lqwt5
    Il ne trouve pas la lib. Pas étonnant, tu n'as pas corrigé l'erreur que je t'avais signalé quelques posts plus hauts.
    LIBS += -LC/::/Qt/qwt-5.1.1/lib -lqwt5
    Enlève un " : ", ça merchera mieux.

    G.
    Un problème avec Qt ? Vous trouverez votre réponse ici : http://doc.trolltech.com/4.6/overviews.html
    En français (traduction réalisée par l'équipe Qt de DVP) : http://qt.developpez.com/doc/4.6/vues-d-ensemble/

  11. #31
    Membre éprouvé

    Profil pro
    Inscrit en
    Mai 2007
    Messages
    774
    Détails du profil
    Informations personnelles :
    Âge : 37
    Localisation : France, Finistère (Bretagne)

    Informations forums :
    Inscription : Mai 2007
    Messages : 774
    Points : 969
    Points
    969
    Par défaut
    et avec DEFINES += QWT_DLL QT_DLL
    ? il me semblais que QT_DLL était obsolète.
    Non plus. Toujours les mêmes erreurs.


    -------------------------------------------------------

    J'ai trouvé ça sur une mailing list, le message date d'un mois. Cela confirme ta théorie, mais le sujet porte sur QwtPlot
    > But if you want to have a derived Qwt class use the signal/slot
    > mechanism, you have to:
    >
    > DEFINES += QWT_DLL
    >
    > in your *.pro file
    Wonderfull. That was the only problem!

    It compiles now and links.
    Un problème avec Qt ? Vous trouverez votre réponse ici : http://doc.trolltech.com/4.6/overviews.html
    En français (traduction réalisée par l'équipe Qt de DVP) : http://qt.developpez.com/doc/4.6/vues-d-ensemble/

  12. #32
    yan
    yan est déconnecté
    Rédacteur
    Avatar de yan
    Homme Profil pro
    Ingénieur expert
    Inscrit en
    Mars 2004
    Messages
    10 033
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Ille et Vilaine (Bretagne)

    Informations professionnelles :
    Activité : Ingénieur expert
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Mars 2004
    Messages : 10 033
    Points : 13 968
    Points
    13 968
    Par défaut
    Bon j'ai refait depuis le début.
    1- compiler qwt en release et debug :
    modifier qwtconfig.pri

    win32 {
    # On Windows you can't mix release and debug libraries.
    # The designer is built in release mode. If you like to use it
    # you need a release version. For your own application development you
    # might need a debug version.
    # Enable debug_and_release + build_all if you want to build both.

    #CONFIG += release # release/debug/debug_and_release
    CONFIG += debug_and_release
    #CONFIG += build_all
    }
    une fois fait et installé, voici le .pro que j'ai utiliser pour compiler l'exemple histogramme à la main :
    ######################################################################
    # Automatically generated by qmake (2.01a) lun. 12. janv. 11:01:52 2009
    ######################################################################

    TEMPLATE = app
    TARGET =
    DEPENDPATH += .
    INCLUDEPATH += . ; C:/Qwt-5.1.1/include

    CONFIG(debug, debug|release) {
    LIBS += -LC:/qwt-5.1.1/lib -lqwtd5
    } else {
    LIBS += -LC:/qwt-5.1.1/lib -lqwt5
    }



    DEFINES += QWT_DLL

    # Input
    HEADERS += histogram_item.h
    SOURCES += histogram_item.cpp main.cpp
    j'ai utilisé qmake -project pour créé le .pro et je l'ai modifier pour ajouter qwt.

    Et je confirme, si tu enlève CONFIG+= QWT_DLL cela ne compile pas sous windows.

  13. #33
    Candidat au Club
    Profil pro
    Inscrit en
    Janvier 2009
    Messages
    23
    Détails du profil
    Informations personnelles :
    Âge : 37
    Localisation : France

    Informations forums :
    Inscription : Janvier 2009
    Messages : 23
    Points : 2
    Points
    2
    Par défaut
    J'ai corrigé le détail dans mon .pro,
    j'ai rajouté le public QObject

    en vain...

    toujours une erreur...

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    C:\Documents and Settings\louise\Mes documents\TestGraphqueDemo>make
    mingw32-make -f Makefile.Debug
    mingw32-make[1]: Entering directory `C:/Documents and Settings/louise/Mes docume
    nts/TestGraphqueDemo'
    g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-rel
    oc -mthreads -Wl -Wl,-subsystem,windows -o debug\TestGraphqueDemo.exe debug/Hist
    ogramItem.o debug/main.o debug/moc_HistogramItem.o  -L"c:\Qt\4.4.3\lib" -lmingw3
    2 -lqtmaind -LC/:/Qt/qwt-5.1.1/lib -lqwt5 -lQtGuid4 -lQtCored4
    C:\MinGW\bin\..\lib\gcc\mingw32\3.4.2\..\..\..\..\mingw32\bin\ld.exe: cannot fin
    d -lqwt5
    collect2: ld returned 1 exit status
    mingw32-make[1]: *** [debug\TestGraphqueDemo.exe] Error 1
    mingw32-make[1]: Leaving directory `C:/Documents and Settings/louise/Mes documen
    ts/TestGraphqueDemo'
    mingw32-make: *** [debug] Error 2

  14. #34
    yan
    yan est déconnecté
    Rédacteur
    Avatar de yan
    Homme Profil pro
    Ingénieur expert
    Inscrit en
    Mars 2004
    Messages
    10 033
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Ille et Vilaine (Bretagne)

    Informations professionnelles :
    Activité : Ingénieur expert
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Mars 2004
    Messages : 10 033
    Points : 13 968
    Points
    13 968
    Par défaut
    Citation Envoyé par personn02 Voir le message
    J'ai corrigé le détail dans mon .pro,
    j'ai rajouté le public QObject

    en vain...

    toujours une erreur...
    -LC/:/Qt/qwt-5.1.1/lib -lqwt5
    tu as une erreur dans ton .pro

  15. #35
    Membre éprouvé

    Profil pro
    Inscrit en
    Mai 2007
    Messages
    774
    Détails du profil
    Informations personnelles :
    Âge : 37
    Localisation : France, Finistère (Bretagne)

    Informations forums :
    Inscription : Mai 2007
    Messages : 774
    Points : 969
    Points
    969
    Par défaut
    Alors déjà, tu parles de DEFINES += QWT_DLL ou CONFIG +=QWT_DLL ?

    Ensuite, j'ai essayé l'un, l'autre, les deux en même temps, et ça ne marche pas. Tu utilises gcc ou le compilateur de VS ? Tu as quel Qt/Qwt ?

    Pour ma part, j'utilise
    Qt 4.4.3
    QWT 5.1.1
    Compilateur de VS Express 2008
    Un problème avec Qt ? Vous trouverez votre réponse ici : http://doc.trolltech.com/4.6/overviews.html
    En français (traduction réalisée par l'équipe Qt de DVP) : http://qt.developpez.com/doc/4.6/vues-d-ensemble/

  16. #36
    Candidat au Club
    Profil pro
    Inscrit en
    Janvier 2009
    Messages
    23
    Détails du profil
    Informations personnelles :
    Âge : 37
    Localisation : France

    Informations forums :
    Inscription : Janvier 2009
    Messages : 23
    Points : 2
    Points
    2
    Par défaut
    J'ai les même version mais pas Compilateur de VS Express 2008

    Toujours une erreur :


    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    C:\Documents and Settings\louise\Mes documents\testGraph>make
    c:\Qt\4.4.3\bin\qmake.exe -win32 -o Makefile testGraph.pro
    mingw32-make -f Makefile.Debug
    mingw32-make[1]: Entering directory `C:/Documents and Settings/louise/Mes docume
    nts/testGraph'
    g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-rel
    oc -mthreads -Wl -Wl,-subsystem,windows -o debug\testGraph.exe debug/HistogramIt
    em.o debug/main.o debug/moc_HistogramItem.o  -L"c:\Qt\4.4.3\lib" -lmingw32 -lqtm
    aind -LC/:/Qt/qwt-5.1.1/lib -lqwt5 -lQtGuid4 -lQtCored4
    C:\MinGW\bin\..\lib\gcc\mingw32\3.4.2\..\..\..\..\mingw32\bin\ld.exe: cannot fin
    d -lqwt5
    collect2: ld returned 1 exit status
    mingw32-make[1]: *** [debug\testGraph.exe] Error 1
    mingw32-make[1]: Leaving directory `C:/Documents and Settings/louise/Mes documen
    ts/testGraph'
    mingw32-make: *** [debug] Error 2

  17. #37
    yan
    yan est déconnecté
    Rédacteur
    Avatar de yan
    Homme Profil pro
    Ingénieur expert
    Inscrit en
    Mars 2004
    Messages
    10 033
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Ille et Vilaine (Bretagne)

    Informations professionnelles :
    Activité : Ingénieur expert
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Mars 2004
    Messages : 10 033
    Points : 13 968
    Points
    13 968
    Par défaut
    Citation Envoyé par Gulish Voir le message
    Alors déjà, tu parles de DEFINES += QWT_DLL ou CONFIG +=QWT_DLL ?
    oups... j'avais pas vue... dsl
    c'est DEFINES+= QWT_DLL que je parle....


    mais maintenant ça compile que j'utilise ou non DEFINES += QWT_DLL...
    y as un truc que je ne pige plus... (c'est peut être parce que j'ai recompiler qwt en debug et release, je ne sait pô)

    Citation Envoyé par Gulish Voir le message
    Ensuite, j'ai essayé l'un, l'autre, les deux en même temps, et ça ne marche pas. Tu utilises gcc ou le compilateur de VS ? Tu as quel Qt/Qwt ?

    Pour ma part, j'utilise
    Qt 4.4.3
    QWT 5.1.1
    Compilateur de VS Express 2008
    pour ce test :
    Qt 4.4.3
    QWT 5.1.1
    mingw

    je testerais ce soir pour visual 2008. Mais normalement c'est la même chose.
    En tout cas avec
    Qt4.4
    qwt 5.1.1
    visual 2005
    c'est ce que je faisais.

    http://qwt.sourceforge.net/qwtinstall.html
    B) Win32/MSVC Qt3/Qt4:

    When you have built a Qwt DLL you need to add the following
    define to your compiler flags: QWT_DLL.
    C) Win32/MinGW Qt4
    When you have built a Qwt DLL you need to add QWT_DLL to your compiler
    flags. If you are using qmake for your own builds this done by adding
    the following line to your profile: "DEFINES += QWT_DLL".
    Cela fait un moment que j'utilise qwt et j'ai toujours faire cela.

  18. #38
    yan
    yan est déconnecté
    Rédacteur
    Avatar de yan
    Homme Profil pro
    Ingénieur expert
    Inscrit en
    Mars 2004
    Messages
    10 033
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Ille et Vilaine (Bretagne)

    Informations professionnelles :
    Activité : Ingénieur expert
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Mars 2004
    Messages : 10 033
    Points : 13 968
    Points
    13 968
    Par défaut
    Citation Envoyé par personn02 Voir le message
    J'ai les même version mais pas Compilateur de VS Express 2008

    Toujours une erreur :
    tu as une erreur dans ton .pro
    C/:/Qt/qwt-5.1.1/lib ca n'existe pas.
    remplace par C:/Qt/qwt-5.1.1/lib
    Ici le compilo te dit qu'il ne trouve pas la lib de qwt et ne peut donc pas faire le link.

  19. #39
    Membre éprouvé

    Profil pro
    Inscrit en
    Mai 2007
    Messages
    774
    Détails du profil
    Informations personnelles :
    Âge : 37
    Localisation : France, Finistère (Bretagne)

    Informations forums :
    Inscription : Mai 2007
    Messages : 774
    Points : 969
    Points
    969
    Par défaut
    Personn02, tu as corrigé ton . pro ? Montre le pour qu'on vérifie stp.

    @ Mongaulois : Je ne sais vraiment pas quoi te dire, ça fait un moment que j'utilise qwt, et je ne mets pas ça dans mon .pro. Ensuite, je ne sais pas si je ne l'ai pas fait tout au début. Si tu dis que ça marche encore chez toi même quand tu l'enlèves.

    Enfin bref, le mystère reste entier.

    Bon ap,

    G.
    Un problème avec Qt ? Vous trouverez votre réponse ici : http://doc.trolltech.com/4.6/overviews.html
    En français (traduction réalisée par l'équipe Qt de DVP) : http://qt.developpez.com/doc/4.6/vues-d-ensemble/

  20. #40
    Candidat au Club
    Profil pro
    Inscrit en
    Janvier 2009
    Messages
    23
    Détails du profil
    Informations personnelles :
    Âge : 37
    Localisation : France

    Informations forums :
    Inscription : Janvier 2009
    Messages : 23
    Points : 2
    Points
    2
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    ######################################################################
    # Automatically generated by qmake (2.01a) ven. 9. janv. 10:22:48 2009
    ######################################################################
     
    TEMPLATE = app
    TARGET = 
    DEPENDPATH += C:/Qt/qwt-5.1.1/lib
    INCLUDEPATH += C:/Qt/qwt-5.1.1/src
    LIBS += -LC/Qt/qwt-5.1.1/lib -lqwt5
     
    CONFIG += QWT_DLL
     
    # Input
    HEADERS += HistogramItem.h
    SOURCES += HistogramItem.cpp main.cpp

+ Répondre à la discussion
Cette discussion est résolue.
Page 2 sur 3 PremièrePremière 123 DernièreDernière

Discussions similaires

  1. problème de compilation sous visual C++
    Par fabmili dans le forum MFC
    Réponses: 4
    Dernier message: 08/02/2004, 19h52
  2. problème de compil devc++ socket
    Par stefdem dans le forum Autres éditeurs
    Réponses: 2
    Dernier message: 11/12/2003, 11h33
  3. Réponses: 1
    Dernier message: 29/10/2003, 12h16
  4. Problème de compilation de la DLL du XMLRad
    Par [DreaMs] dans le forum XMLRAD
    Réponses: 2
    Dernier message: 16/04/2003, 16h46
  5. Réponses: 1
    Dernier message: 27/05/2002, 01h44

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo