snmpb compile error bei neuerem g++

OP #7115274
Lesenswert?

Moin,

grad' versuch' ich mal den snmpb aus sourcen unter Linux zu bauen. Das 
hat frueher (mit aelteren gccs) geklappt; derweilen hab' ich aber einen 
gcc-11.2.0; der kommt anscheinend mit irgendwelchem c++ kram nicht mehr 
so zurecht wie seine Vorgaenger.
Das hier scheint mir ein Problem zu sein:
1
make[1]: Entering directory '/usr/src/snmpb-code/app'
2
g++ -c -pipe -g -Wall -Wextra -D_REENTRANT -fPIC -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -I../snmp++/include -I../snmp++ -I../libtomcrypt/src/headers -I../libsmi/lib -I../qwt/src -I/opt/qt-5.15.2/include -I/opt/qt-5.15.2/include/QtWidgets -I/opt/qt-5.15.2/include/QtGui -I/opt/qt-5.15.2/include/QtCore -I.moc -I../../../include/libdrm -I.ui -I/opt/qt-5.15.2/mkspecs/linux-g++ -o .obj/graph.o graph.cpp
3
graph.cpp:472:5: error: return type ‘class QwtText’ is incomplete
4
  472 |     {
5
      |     ^
6
graph.cpp: In member function ‘virtual void tracker::trackerText(const QPoint&) const’:
7
graph.cpp:476:17: error: variable ‘QwtText text’ has initializer but incomplete type
8
  476 |         QwtText text = QwtPlotZoomer::trackerText(pos);
9
      |                 ^~~~
10
graph.cpp:476:50: error: invalid use of incomplete type ‘class QwtText’
11
  476 |         QwtText text = QwtPlotZoomer::trackerText(pos);
12
      |                        ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
13
In file included from ../qwt/src/qwt_plot_dict.h:14,
14
                 from ../qwt/src/qwt_plot.h:15,
15
                 from graph.h:25,
16
                 from graph.cpp:24:
17
../qwt/src/qwt_plot_item.h:20:7: note: forward declaration of ‘class QwtText’
18
   20 | class QwtText;
19
      |       ^~~~~~~
20
graph.cpp: In constructor ‘Graph::Graph(Snmpb*, QString*)’:
21
graph.cpp:482:56: error: no matching function for call to ‘QwtPlot::QwtPlot(QString)’

Und das scheint mir die Funktion/Methode/Whatever zu sein, die Malheur 
macht:
1
class tracker: public QwtPlotZoomer
2
{
3
public:
4
    tracker(QWidget *canvas):
5
        QwtPlotZoomer(canvas)
6
    {
7
        setTrackerMode(AlwaysOn);
8
    }
9

10
    virtual QwtText trackerText(const QPoint &pos) const
11
    { //<- 472,5
12
        QColor bg(Qt::white);
13
        bg.setAlpha(200);
14

15
        QwtText text = QwtPlotZoomer::trackerText(pos); //<- 476
16
        text.setBackgroundBrush( QBrush( bg ));
17
        return text;
18
    }
19
};

Nun hab' ich keine Ahnung von c++; sieht hier irgendwer mit mehr Ahnung, 
wo's da klemmt?

Das Problem scheint mir bei verschiedenen Forks von snmpb immer 
aufzutauchen;
Obige src sind von
https://github.com/gavioto/snmpb-code
sieht aber im "original" von sourceforge nicht besser aus...

Gruss
WK
Gast #7115408
Lesenswert?

Dergute W. schrieb:
> graph.cpp:472:5: error: return type ‘class QwtText’ is incomplete

warscheinlich wurde QwtText früher durch eine andere Bibliotek implizit 
eingebunden. Der Fehler müsste sich durch das Einfügen von
1
#include <qwt_text.h>

am Anfang vom graph.cpp beheben lassen.

Zum zweiten Fehler würde ich mal folgendes probieren:
1
Graph::Graph(Snmpb *snmpb, QString *n): QwtPlot(n?*n:"")
ändern in
1
Graph::Graph(Snmpb *snmpb, QString *n): QwtPlot(QwtText(n?*n:""))
OP #7115423
Lesenswert?

Moin,

Zombie schrieb:
> Der Fehler müsste sich durch das Einfügen von
> #include <qwt_text.h>
>
> am Anfang vom graph.cpp beheben lassen.
Heissen Dank! Das sieht gut aus. make rennt durch; snmpb binary oxidiert 
im app Verzeichnis 'rum; nach Installation startet snmpb auch; sieht 
erstmal wie gewohnt aus.

Zombie schrieb:
> Zum zweiten Fehler
Hat sich aufgeloest, oder in warnings verwandelt; so schnell kann ich 
nich gucken.

Merci nochmal!

Gruss
WK

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren