strange error in compilation
i am having strange error in compilation. I am presenting some part of my header file and output on terminal
Code:
#ifndef vA_H
#define vA_H
//QT4 includes
#include <QObject>
//QGIS includes
#include <qgisapp.h>
#include <qgsmaptool.h>
#include <qgsmapcanvas.h>
#include<qgspoint.h>
#include "../qgisplugin.h"
#include<QToolBar>
//#include "vARubberBand.h"
//forward declarations
//class QToolBar;
class vARubberBand;
/**
* \class Plugin
* \brief [name] plugin for QGIS
* [description]
*/
class vA1:public QgsMapTool , public QgisPlugin
{
Q_OBJECT;
public:
vA1(QgisApp * theApplication, QgisIface * theInterface);
//! Destructor
virtual ~vA1();
//! inherited from QgsMapTool
part of output is
Quote:
g++ -DHAVE_CONFIG_H -I. -I. -I../../.. -g -O2 -DQT3_SUPPORT -I/usr/local/Trolltech/Qt-4.1.2//mkspecs/default -I/usr/local/Trolltech/Qt-4.1.2//include/Qt3Support -I/usr/local/Trolltech/Qt-4.1.2//include/QtCore -I/usr/local/Trolltech/Qt-4.1.2//include/QtDesigner -I/usr/local/Trolltech/Qt-4.1.2//include/QtGui -I/usr/local/Trolltech/Qt-4.1.2//include/QtNetwork -I/usr/local/Trolltech/Qt-4.1.2//include/QtOpenGL -I/usr/local/Trolltech/Qt-4.1.2//include/QtSql -I/usr/local/Trolltech/Qt-4.1.2//include/QtXml -I/usr/local/Trolltech/Qt-4.1.2//include -I/usr/local/Trolltech/Qt-4.1.2//include/QtSvg -I/usr/local/Trolltech/Qt-4.1.2//include/QtTest -I/usr/local/Trolltech/Qt-4.1.2//include/QtDesigner -D_REENTRANT -DQT_THREAD_SUPPORT -DNO_DEBUG -I/usr/local/include -I/usr/include -I../../core -I../../ui -I../../gui -I../../raster -g -O2 -MT libqgis_plugin_va_la-va.lo -MD -MP -MF .deps/libqgis_plugin_va_la-va.Tpo -c va.cpp -fPIC -DPIC -o .libs/libqgis_plugin_va_la-va.o
/usr/local/Trolltech/Qt-4.1.2//include/QtGui/qmenubar.h:29: error: expected initializer before 'QtGuiModule'
va.cpp: In member function 'virtual void vA1::initGui()':
va.cpp:98: error: no matching function for call to 'QAction::QAction(QIcon, const char [4], vA1* const)'
/usr/local/Trolltech/Qt-4.1.2//include/QtGui/qaction.h:173: note: candidates are: QAction::QAction(const QAction&)
/usr/local/Trolltech/Qt-4.1.2//include/QtGui/qaction.h:73: note: QAction::QAction(const QIcon&, const QString&, const QKeySequence&, QObject*, const char*)
/usr/local/Trolltech/Qt-4.1.2//include/QtGui/qaction.h:70: note: QAction::QAction(const QString&, const QKeySequence&, QObject*, const char*)
/usr/local/Trolltech/Qt-4.1.2//include/QtGui/qaction.h:68: note: QAction::QAction(QObject*, const char*)
/usr/local/Trolltech/Qt-4.1.2//include/QtGui/qaction.h:65: note: QAction::QAction(const QIcon&, const QString&, QObject*)
/usr/local/Trolltech/Qt-4.1.2//include/QtGui/qaction.h:64: note: QAction::QAction(const QString&, QObject*)
/usr/local/Trolltech/Qt-4.1.2//include/QtGui/qaction.h:63: note: QAction::QAction(QObject*)
This code is part of a os project so i will not be in a position to post all code. But what i have figured out is it has got something to do with inclusion of some header files.
Similar code is working fine but i am caught here.
regards
quickNitin
Re: strange error in compilation
What does your project file look like?
Re: strange error in compilation
there is no pro file in my code.
As i told earlier this code is part of a open souce gis qgis.There is a perl sript which make changes in major configuration files so i am not worried about them. And it was working fine for earlier work.
Only this time it has stuck. I am not aware about need of project file.
Also before that it was giving me problem with following code
Code:
#
nclude <qgisapp.h>
#
#include <qgsmaptool.h>
#
#include <qgsmapcanvas.h>
#
#include<qgspoint.h>
#
#include "../qgisplugin.h"
#
//#include<QToolBar> [COLOR="Red"]no inclusion of QToolBar headers[/COLOR]
#
//#include "vARubberBand.h"
#
#
//forward declarations
#
#
class
QToolBar;
[COLOR
="Red"]FORWARD DECLARATION OF CLASS
#[/COLOR]
class vARubberBand;
#
/**
#
* \class Plugin
#
* \brief [name] plugin for QGIS
#
* [description]
#
*/
#
class vA1:public QgsMapTool , public QgisPlugin
#
{
#
Q_OBJECT;
#
public:
#
vA1(QgisApp * theApplication, QgisIface * theInterface);
#
//! Destructor
#
virtual ~vA1();
#
#
//! inherited from QgsMapTool
It was reporting about some multiple declarations
regards
quickNitin
Re: strange error in compilation
Quote:
Originally Posted by quickNitin
there is no pro file in my code.
That's not good
This line in qmenubar.h:
Code:
usr/local/Trolltech/Qt-4.1.2//include/QtGui/qmenubar.h:29: error: expected initializer before 'QtGuiModule'
is calling macro (it's in qglobal.h):
which translates to:
Code:
typedef QtValidLicenseForGuiModule QtGuiModule
But QtValidLicenseForGuiModule is defined only if QT_LICENSED_MODULE(Gui) macro is called. And this macro is called only if expression:
Code:
QT_EDITION & QT_MODULE_GUI
evaluates to true. It evaluates to true only if QT_EDITION equals QT_EDITION_DESKTOPLIGHT or QT_EDITION_OPENSOURCE or QT_EDITION_DESKTOP. And QT_EDITION will be set to QT_EDITION_DESKTOP if you ie. build your project in a standard way:
Code:
qmake -project
qmake
make
project file by ' qmake -pro'
well i accept my arrogance of this aspect and insufficient knowledge of Qt. I will work on it.
project file generated is as
Code:
######################################################################
# Automatically generated by qmake (1.07a) Wed Aug 30 15:08:08 2006
######################################################################
TEMPLATE = app
INCLUDEPATH += .
# Input
HEADERS += ui_vaguibase.h \
va.h \
vagui.h \
vaguibase.ui.h \
vaRubberBand.h \
vARubberBand.h \
vATool.h
INTERFACES += vaguibase.ui
SOURCES += va.cpp va.moc.cpp va.qrc.cpp vagui.cpp vagui.moc.cpp vARubberBand.cpp
but it is still giving same output.
Re: project file by ' qmake -pro'
Quote:
Originally Posted by quickNitin
but it is still giving same output.
Really? Is "qmenubar.h:29: error: expected initializer before 'QtGuiModule'" still there? Well, in that case I have no more ideas what the solution could be.
As far as the second error is concerned:
Code:
va.cpp: In member function 'virtual void vA1::initGui()':
va.cpp:98: error: no matching function for call to 'QAction::QAction(QIcon, const char [4], vA1* const)'
/usr/local/Trolltech/Qt-4.1.2//include/QtGui/qaction.h:173: note: candidates are: QAction::QAction(const QAction&)
...
It seems that in line 98 of va.cpp you are calling QAction constructor, but with wrong parameters. There is no QAction(QIcon, const char [4], vA1* const) constructor (at least according to compiler :) ) and it gives you a list of similar ones, which exist.
Re: strange error in compilation
about QAction constructor error i had checked arguments do match and constructor also exists but it is giving me this error.
Here is snap of that code
Code:
void vA1::initGui()
{
// Create the action for tool
mQActionPointer
= new QAction(QIcon(":/va/va.png"),
"vA1",
this);
// Set the what's this text
At http://doc.trolltech.com/4.1/qaction.html i found this
Code:
Public Functions
[/COLOR]
About my other issue i request experienced users to guide me in this.
Re: QObject was not included
Quote:
Originally Posted by quickNitin
va.cpp line 54: multiple types in one declaration
i donot have reasoning for such behaviour.
Just add the missing semicolon after your class definition.
Re: strange error in compilation
thanks jacek!. I couldn't even imagine that this isssue was there.