Results 1 to 1 of 1
Hi all,
is the first time that I'm programming in linux, using kubuntu, with the Qt3 libraries and KDevelop. Try to do a GUI for a programm done in C. ...
- 04-25-2007 #1Just Joined!
- Join Date
- Apr 2007
- Location
- Kuopio, Finland
- Posts
- 1
compiling problems KDevelop
Hi all,
is the first time that I'm programming in linux, using kubuntu, with the Qt3 libraries and KDevelop. Try to do a GUI for a programm done in C. I used QtDesigner to do it and it generated a .ui file. Using uic I creat the .h and .cpp files from that .ui file.
Now I'm using KDevelop to match both, my GUI and the programm made in C. I have 5 files:
gui_bt.h and gui_bt.cpp files created from .ui file. I cannot modify these files.
gui.h , gui.cpp and main.cpp files that I creat
when I try to compile the project it appears this problem:
make all-recursive
make[1]: se ingresa al directorio `/home/aitor/userinterface'
Making all in doc
make[2]: se ingresa al directorio `/home/aitor/userinterface/doc'
Making all in .
make[3]: se ingresa al directorio `/home/aitor/userinterface/doc'
make[3]: No se hace nada para `all-am'.
make[3]: se sale del directorio `/home/aitor/userinterface/doc'
Making all in en
make[3]: se ingresa al directorio `/home/aitor/userinterface/doc/en'
make[3]: No se hace nada para `all'.
make[3]: se sale del directorio `/home/aitor/userinterface/doc/en'
make[2]: se sale del directorio `/home/aitor/userinterface/doc'
Making all in po
make[2]: se ingresa al directorio `/home/aitor/userinterface/po'
make[2]: No se hace nada para `all'.
make[2]: se sale del directorio `/home/aitor/userinterface/po'
Making all in src
make[2]: se ingresa al directorio `/home/aitor/userinterface/src'
if g++ -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/include/kde -I/usr/share/qt3/include -I. -DQT_THREAD_SUPPORT -D_REENTRANT -Wnon-virtual-dtor -Wno-long-long -Wundef -Wall -W -Wpointer-arith -Wwrite-strings -ansi -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wcast-align -Wconversion -Wchar-subscripts -O2 -Wformat-security -Wmissing-format-attribute -fno-exceptions -fno-check-new -fno-common -MT gui.o -MD -MP -MF ".deps/gui.Tpo" -c -o gui.o gui.cpp; \
then mv -f ".deps/gui.Tpo" ".deps/gui.Po"; else rm -f ".deps/gui.Tpo"; exit 1; fi
if g++ -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/include/kde -I/usr/share/qt3/include -I. -DQT_THREAD_SUPPORT -D_REENTRANT -Wnon-virtual-dtor -Wno-long-long -Wundef -Wall -W -Wpointer-arith -Wwrite-strings -ansi -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wcast-align -Wconversion -Wchar-subscripts -O2 -Wformat-security -Wmissing-format-attribute -fno-exceptions -fno-check-new -fno-common -MT main.o -MD -MP -MF ".deps/main.Tpo" -c -o main.o main.cpp; \
then mv -f ".deps/main.Tpo" ".deps/main.Po"; else rm -f ".deps/main.Tpo"; exit 1; fi
/bin/bash ../libtool --silent --tag=CXX --mode=link g++ -Wnon-virtual-dtor -Wno-long-long -Wundef -Wall -W -Wpointer-arith -Wwrite-strings -ansi -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wcast-align -Wconversion -Wchar-subscripts -O2 -Wformat-security -Wmissing-format-attribute -fno-exceptions -fno-check-new -fno-common -o userinterface -R /usr/lib -R /usr/share/qt3/lib -R /usr/lib -L/usr/lib -L/usr/share/qt3/lib gui_bt.o gui.o main.o gui_bt.o -lkdeui
gui_bt.o: In function `GUI_BT::className() const':
gui_bt.cpp: (.text+0x0): multiple definition of `GUI_BT::className() const'
gui_bt.o:gui_bt.cpp: (.text+0x0): first defined here
gui_bt.o: In function `GUI_BT::qt_static_property(QObject*, int, int, QVariant*)':
gui_bt.cpp: (.text+0x10): multiple definition of `GUI_BT::qt_static_property(QObject*, int, int, QVariant*)'
gui_bt.o:gui_bt.cpp: (.text+0x10): first defined here
gui_bt.o: In function `GUI_BT::staticMetaObject()':
gui_bt.cpp: (.text+0x160): multiple definition of `GUI_BT::staticMetaObject()'
gui_bt.o:gui_bt.cpp
.text+0x160): first defined here
gui_bt.o: In function `GUI_BT::qt_property(int, int, QVariant*)':
gui_bt.cpp
.text+0xa0): multiple definition of `GUI_BT::qt_property(int, int, QVariant*)'
gui_bt.o:gui_bt.cpp: (.text+0xa0): first defined here
/....more equal errors.../
gui_bt.o: In function `GUI_BT::GUI_BT(QWidget*, char const*, unsigned int)':
gui_bt.cpp: (.text+0xa30): multiple definition of `GUI_BT::GUI_BT(QWidget*, char const*, unsigned int)'
gui_bt.o:gui_bt.cpp: (.text+0xa30): first defined here
collect2: ld returned 1 exit status
make[2]: *** [userinterface] Error 1
make[2]: se sale del directorio `/home/aitor/userinterface/src'
make[1]: *** [all-recursive] Error 1
make[1]: se sale del directorio `/home/aitor/userinterface'
make: *** [all] Error 2
It seems to be just a problem in the gui_bt.cpp file but I've been trying a lot of different things and searching on internet and I didn't find anything to solve it.
As it seems also that theese are only syntactical errors and warnings I put also the files here if someone wants to look at them and please give me some advice....
gui_bt.h
#ifndef GUI_BT_H
#define GUI_BT_H
#include <qvariant.h>
#include <qwidget.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QSpacerItem;
class QButtonGroup;
class QPushButton;
class QTextEdit;
class GUI_BT : public QWidget
{
Q_OBJECT
public:
GUI_BT( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
~GUI_BT();
QButtonGroup* Menu;
QPushButton* b_scan;
QPushButton* b_save;
QPushButton* b_redfang;
QPushButton* b_exit;
QTextEdit* Expl;
QTextEdit* Result;
public slots:
virtual void scan();
virtual void talletus();
virtual void redFang();
virtual void exit();
protected:
protected slots:
virtual void languageChange();
};
#endif // GUI_BT_H
gui_bt.cpp
#include <kdialog.h>
#include <klocale.h>
#include "gui_bt.h"
#include <qvariant.h>
#include <qbuttongroup.h>
#include <qpushbutton.h>
#include <qtextedit.h>
#include <qlayout.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
/*
* Constructs a GUI_BT as a child of 'parent', with the
* name 'name' and widget flags set to 'f'.
*/
GUI_BT::GUI_BT( QWidget* parent, const char* name, WFlags fl )
: QWidget( parent, name, fl )
{
if ( !name )
setName( "GUI_BT" );
Menu = new QButtonGroup( this, "Menu" );
Menu->setGeometry( QRect( 50, 90, 150, 260 ) );
b_scan = new QPushButton( Menu, "b_scan" );
b_scan->setGeometry( QRect( 20, 30, 112, 24 ) );
b_save = new QPushButton( Menu, "b_save" );
b_save->setGeometry( QRect( 20, 90, 112, 24 ) );
b_redfang = new QPushButton( Menu, "b_redfang" );
b_redfang->setGeometry( QRect( 20, 150, 112, 24 ) );
b_exit = new QPushButton( Menu, "b_exit" );
b_exit->setGeometry( QRect( 20, 210, 112, 24 ) );
Expl = new QTextEdit( this, "Expl" );
Expl->setGeometry( QRect( 260, 30, 320, 110 ) );
Result = new QTextEdit( this, "Result" );
Result->setGeometry( QRect( 260, 200, 320, 260 ) );
languageChange();
resize( QSize(600, 480).expandedTo(minimumSizeHint()) );
clearWState( WState_Polished );
// signals and slots connections
connect( b_scan, SIGNAL( clicked() ), this, SLOT( scan() ) );
connect( b_save, SIGNAL( clicked() ), this, SLOT( talletus() ) );
connect( b_redfang, SIGNAL( clicked() ), this, SLOT( redFang() ) );
connect( b_exit, SIGNAL( clicked() ), this, SLOT( exit() ) );
}
/*
* Destroys the object and frees any allocated resources
*/
GUI_BT::~GUI_BT()
{
// no need to delete child widgets, Qt does it all for us
}
/*
* Sets the strings of the subwidgets using the current
* language.
*/
void GUI_BT::languageChange()
{
setCaption( tr2i18n( "BT scanning program" ) );
Menu->setTitle( tr2i18n( "MENU" ) );
b_scan->setText( tr2i18n( "Scan" ) );
b_save->setText( tr2i18n( "Scan and Save" ) );
b_save->setAccel( QKeySequence( QString::null ) );
b_redfang->setText( tr2i18n( "RedFang" ) );
b_exit->setText( tr2i18n( "Exit" ) );
}
void GUI_BT::scan()
{
qWarning( "GUI_BT::scan(): Not implemented yet" );
}
void GUI_BT::talletus()
{
qWarning( "GUI_BT::talletus(): Not implemented yet" );
}
void GUI_BT::redFang()
{
qWarning( "GUI_BT::redFang(): Not implemented yet" );
}
void GUI_BT::exit()
{
qWarning( "GUI_BT::exit(): Not implemented yet" );
}
#include "gui_bt.moc"
gui.h
#ifndef GUI_H
#define GUI_H
#include <gui_bt.h>
class gui : public GUI_BT
{
public:
gui();
~gui();
};
#endif
gui.cpp
#include "gui.h"
gui::gui()
: GUI_BT()
{
}
gui::~gui()
{
}
main.cpp
#include "gui.h"
#include "gui_bt.h"
#include <qapplication.h>
int main( int argc,char ** argv )
{
QApplication Main( argc,argv ); //create the Qt app.
gui Form; //build the form from the class
Form.show(); //show Form
Form.setCaption("hola");
return Main.exec();
};
I think that like this, the programm doesn't do anything, but at least it has to compile and run good. I don't know what is happening......
I'm really really sorry for this long post.
Thank you.


Reply With Quote