Results 1 to 10 of 10

Thread: strange error in compilation

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2006
    Location
    Switzerland
    Posts
    52
    Thanked 13 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default 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:
    Qt Code:
    1. va.cpp: In member function 'virtual void vA1::initGui()':
    2. va.cpp:98: error: no matching function for call to 'QAction::QAction(QIcon, const char [4], vA1* const)'
    3. /usr/local/Trolltech/Qt-4.1.2//include/QtGui/qaction.h:173: note: candidates are: QAction::QAction(const QAction&)
    4. ...
    To copy to clipboard, switch view to plain text mode 
    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.
    The Wheel weaves as the Wheel wills.

  2. #2
    Join Date
    Apr 2006
    Posts
    122
    Thanks
    18
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default 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
    Qt Code:
    1. void vA1::initGui()
    2. {
    3.  
    4. // Create the action for tool
    5. mQActionPointer = new QAction(QIcon(":/va/va.png"),"vA1", this);
    6. // Set the what's this text
    To copy to clipboard, switch view to plain text mode 
    At http://doc.trolltech.com/4.1/qaction.html i found this
    Qt Code:
    1. Public Functions
    2.  
    3. QAction ( QObject * parent )
    4.  
    5. QAction ( const QString & text, QObject * parent )
    6.  
    7. [COLOR="Blue"]QAction ( const QIcon & icon, const QString & text, QObject * parent )
    8. [/COLOR]
    9. ~QAction ()
    To copy to clipboard, switch view to plain text mode 


    About my other issue i request experienced users to guide me in this.
    Last edited by quickNitin; 30th August 2006 at 11:15. Reason: addition ot post

  3. #3
    Join Date
    Apr 2006
    Posts
    122
    Thanks
    18
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default QObject was not included

    for isssue
    Qt Code:
    1. va.cpp: In member function 'virtual void vA1::initGui()':
    2.  
    3. va.cpp:98: error: no matching function for call to 'QAction::QAction(QIcon, const char [4], vA1* const)'
    4.  
    5. /usr/local/Trolltech/Qt-4.1.2//include/QtGui/qaction.h:173: note: candidates are: QAction::QAction(const QAction&)
    6.  
    7. ...
    To copy to clipboard, switch view to plain text mode 
    i found that i hadn't included QObject class which i did so up mentioned error went away.

    About second issue of
    Qt Code:
    1. usr/local/Trolltech/Qt-4.1.2//include/QtGui/qmenubar.h:29: error: expected initializer before 'QtGuiModule'
    To copy to clipboard, switch view to plain text mode 

    i changed my header file as
    Qt Code:
    1. #ifndef vA_H
    2. #define vA_H
    3.  
    4. //QT4 includes
    5. #include <QObject>
    6.  
    7. //QGIS includes
    8. #include <qgisapp.h>
    9. #include <qgsmaptool.h>
    10. #include <qgsmapcanvas.h>
    11. #include<qgspoint.h>
    12. #include "../qgisplugin.h"
    13.  
    14. #include "vARubberBand.h"
    15. ;
    16. //forward declarations
    17.  
    18. class QToolBar;// LINE NO 54
    19.  
    20. /**
    21. * \class Plugin
    22. * \brief [name] plugin for QGIS
    23. * [description]
    24. */
    25. class vA1:public QObject, public QgsMapTool , public QgisPlugin
    26. {
    27. Q_OBJECT;
    28. public:
    To copy to clipboard, switch view to plain text mode 

    i think you will be noticing the semicolon after line
    Qt Code:
    1. #include "vARubberBand.h"
    To copy to clipboard, switch view to plain text mode 
    , this is what i did a sort of hit and trial to compile it. It did. If i didn't put this semicolon it give the message
    Qt Code:
    1. va.cpp line 54: multiple types in one declaration
    To copy to clipboard, switch view to plain text mode 
    i donot have reasoning for such behaviour. Kindly anyone put some light on this issue. All comments, suggestion and other solutions are welcome

    reagrds
    quickNitin

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default 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.

  5. The following user says thank you to jacek for this useful post:

    quickNitin (30th August 2006)

  6. #5
    Join Date
    Apr 2006
    Posts
    122
    Thanks
    18
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: strange error in compilation

    thanks jacek!. I couldn't even imagine that this isssue was there.

Similar Threads

  1. very strange behaviour
    By regix in forum Qt Programming
    Replies: 23
    Last Post: 20th July 2006, 17:38
  2. [Win32/VC++ 8.0] Strange problems with qrc_*.cpp files
    By mloskot in forum Installation and Deployment
    Replies: 6
    Last Post: 6th March 2006, 10:28

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.