Find the answer to your Linux question:
Results 1 to 2 of 2
Hey all - I'm using KDevelop 3.3.5 and trying to make a Qt application. When I try to build the project, I get some nasty errors. Basically, I have a ...
  1. #1
    Just Joined!
    Join Date
    Feb 2007
    Posts
    17

    Cannot compile Qt apps in KDevelop

    Hey all -

    I'm using KDevelop 3.3.5 and trying to make a Qt application.
    When I try to build the project, I get some nasty errors.

    Basically, I have a User Interface file (base.ui), a main .cpp file (test666.cpp), and a helper class (download.ccp and download.h). The "download" class contains code the proper event handler to react to a mouse click on a button that I placed in the .ui file.

    Code:
    cd '/home/andrew/test666' && QTDIR="/usr/lib/qt3" gmake -j1 
    cd src && gmake -f Makefile 
    compiling test666.cpp (g++)
    test666.cpp:29: warning: unused parameter ‘argc’
    test666.cpp:29: warning: unused parameter ‘argv’
    compiling download.cpp (g++)
    In file included from download.cpp:20:
    download.h:23:18: error: base.h: No such file or directory
    download.h:25: error: expected class-name before ‘{’ token
    download.h:26: error: ISO C++ forbids declaration of ‘Q_OBJECT’ with no type
    download.h:27: error: expected ‘;’ before ‘public’
    download.h:29: error: expected `:' before ‘slots’
    download.h:30: error: expected primary-expression before ‘virtual’
    download.h:30: error: ISO C++ forbids declaration of ‘slots’ with no type
    download.h:30: error: expected ‘;’ before ‘virtual’
    download.cpp:22: error: expected `)' before ‘*’ token
    download.cpp:27: error: no ‘void Download::pushButton1_clicked()’ member function declared in class ‘Download’
    download.cpp: In member function ‘void Download::pushButton1_clicked()’:
    download.cpp:29: error: ‘cout’ was not declared in this scope
    gmake[1]: *** [download.o] Error 1
    gmake: *** [sub-src-make_default] Error 2
    *** Exited with status: 2 ***
    Here's my download.cpp

    Code:
    #include "download.h"
    
    Download::Download(QWidget *parent, const char *name)
        :Form1(parent, name)
    {
    }
    
    void Download::pushButton1_clicked()
    {
    	cout > "Hello!";
    }
    and my download.h

    Code:
    #ifndef DOWNLOAD_H
    #define DOWNLOAD_H
    
    #include "base.h"
    
    class Download: public Form1 {
    Q_OBJECT
    public:
        Download(QWidget *parent = 0, const char *name = 0);
    public slots:
        virtual void pushButton1_clicked();
    };
    
    #endif
    and my test666.cpp

    Code:
    #ifdef HAVE_CONFIG_H
    #include <config.h>
    #endif
    
    #include <stdio.h>
    #include <stdlib.h>
    
    int main(int argc, char *argv[])
    {
      printf("Hello, world!\n");
    
      return EXIT_SUCCESS;
    }
    It is probably important to not that when i try to "rebulid" the project in KDevelop, I get this error -

    Code:
    cd '/home/Andrew/Projects/test666' && QTDIR="/usr/lib/qt3" gmake -j1 clean && QTDIR="/usr/lib/qt3" gmake -j1 
    cd src && gmake -f Makefile clean
    rm -f moc_download.cpp
    rm -f qmake_image_collection.cpp
    rm -f ui_base.h
    rm -f test666.o download.o moc_download.o
    rm -f *~ core *.core
    cd src && gmake -f Makefile 
    generating ui_base.h (uic)
    uic: File generated with too old version of Qt Designer
    File 'base.ui' is not valid
    gmake[1]: *** [ui_base.h] Error 1
    gmake: *** [sub-src-make_default] Error 2
    I recently upgraded to the very latest version of Qt in order to eliminate one of those errors, but I had no success.

    It appears as if no header file is being generated for my .ui file - definitely abnormal and a good explanation of several of my errors

    Any ideas?

  2. #2
    Just Joined!
    Join Date
    Jan 2008
    Posts
    2
    Hi, you got further than me...

    The first thing i should fix is that you don't seem to have the file base.h

    I have tried to compile my project with make and a Makefile produced by qmake, but it seems to be a problem with my installation. I put a question on this on the Setting QT Path thread if you have any information on how to solve my problem.

    /Gaborone

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...