Re: Need help installing.
Quote:
I have followed the instructions in the file above, but I've missed something. I either get "missing reference vtable for MainWindow" if I try to create the simple easy default project that you get with each new project.
Make sure you are using Q_OBJECT macro in your class declaration. If you are, then something is going wrong with building, and moc isn't run, or isn't run correctly. As I don't use Dev-C++, I can't really help you. Look into the .pro file, and maybe post it here. Also, post the code too.
Quote:
If I try to compile an old working project it complains about missing members.
What do you mean by an "old" and "working"? If it's Qt3 than it wont work with Qt4. Is it Qt4, and works when you build it from command line, but doesn't work when built from the Dev-C++ environment? What are the exact errors, and the offending code? This could be a completely unrelated problem.
Quote:
Oh. I'll try to send more information tomorrow, but if someone has any better method of integrating Dev-C++ and Qt 4.1 open source, please report them.
Can't help you directly with that, as I don't use Dev-C++. qmake + make works for me.
Bojan
Re: Need help installing. (Dev-C++)
Here is the code that doesn't work:
main.cpp
Code:
#include <QApplication>
#include "mainwindow.h"
int main(int argc, char *argv[])
{
MainWindow *MainForm = new MainWindow;
MainForm->show();
return app.exec();
}
mainwindow.h
Code:
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include "mainwindow_ui.h"
{
Q_OBJECT
public:
private:
Ui::MainWindow ui;
};
#endif
mainwindow.cpp
Code:
#include <QtGui>
#include "mainwindow.h"
MainWindow
::MainWindow(QWidget *parent
){
ui.setupUi(this);
}
mainwindow.ui
Code:
<ui version="4.0" >
<author></author>
<comment></comment>
<exportmacro></exportmacro>
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>425</width>
<height>248</height>
</rect>
</property>
<property name="windowTitle" >
<string>Test QT DevCPP</string>
</property>
<widget class="QWidget" name="centralWidget" />
</widget>
<pixmapfunction></pixmapfunction>
<resources/>
<connections/>
</ui>
And here is the compile errors
Code:
Compiler: Qt
Building Makefile: "E:\slask\Qt1\Makefile.win"
Executing make clean
rm -f mainwindow.o main.o mainwindow_moc.o Project1.exe
g++.exe -c mainwindow.cpp -o mainwindow.o -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"C:/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp/include/c++/3.4.2" -I"C:/Dev-Cpp/include" -I"C:/Qt/4.1.0/include" -I"C:/Qt/4.1.0/include/QtGui" -I"C:/Qt/4.1.0/include/Qt" -I"C:/Qt/4.1.0/include/QtCore" -I"C:/Qt/4.1.0/include/QtDesigner" -I"C:/Qt/4.1.0/include/QtNetwork" -I"C:/Qt/4.1.0/include/QtUiTools" -I"C:/Qt/4.1.0/mkspecs/win32-g++" -I"C:/QT/4.1.0/mkspecs/win32-g++" -I"C:/QT/4.1.0/include" -DWIN32 -ansi -fexceptions
g++.exe -c main.cpp -o main.o -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"C:/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp/include/c++/3.4.2" -I"C:/Dev-Cpp/include" -I"C:/Qt/4.1.0/include" -I"C:/Qt/4.1.0/include/QtGui" -I"C:/Qt/4.1.0/include/Qt" -I"C:/Qt/4.1.0/include/QtCore" -I"C:/Qt/4.1.0/include/QtDesigner" -I"C:/Qt/4.1.0/include/QtNetwork" -I"C:/Qt/4.1.0/include/QtUiTools" -I"C:/Qt/4.1.0/mkspecs/win32-g++" -I"C:/QT/4.1.0/mkspecs/win32-g++" -I"C:/QT/4.1.0/include" -DWIN32 -ansi -fexceptions
g++.exe -c mainwindow_moc.cpp -o mainwindow_moc.o -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"C:/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp/include/c++/3.4.2" -I"C:/Dev-Cpp/include" -I"C:/Qt/4.1.0/include" -I"C:/Qt/4.1.0/include/QtGui" -I"C:/Qt/4.1.0/include/Qt" -I"C:/Qt/4.1.0/include/QtCore" -I"C:/Qt/4.1.0/include/QtDesigner" -I"C:/Qt/4.1.0/include/QtNetwork" -I"C:/Qt/4.1.0/include/QtUiTools" -I"C:/Qt/4.1.0/mkspecs/win32-g++" -I"C:/QT/4.1.0/mkspecs/win32-g++" -I"C:/QT/4.1.0/include" -DWIN32 -ansi -fexceptions
g++.exe mainwindow.o main.o mainwindow_moc.o -o "Project1.exe" -L"C:/Dev-Cpp/lib" -L"C:/Qt/4.1.0/lib" -L"C:/QT/4.1.0/lib" -lmingw32 -lqtmain -lQtCore4 -lQtGui4
mainwindow.o(.text+0x16f):mainwindow.cpp: undefined reference to `vtable for MainWindow'
mainwindow.o(.text+0x17b):mainwindow.cpp: undefined reference to `vtable for MainWindow'
mainwindow.o(.text+0x25b):mainwindow.cpp: undefined reference to `vtable for MainWindow'
mainwindow.o(.text+0x267):mainwindow.cpp: undefined reference to `vtable for MainWindow'
collect2: ld returned 1 exit status
make.exe: *** [Project1.exe] Error 1
Execution terminated
I have followed these instructions
http://www.sortinonline.it/download/...T4_Dev-C++.zip
Anyone here with a working Qt 4 and Dev-C++ setup?
In that case, please have a look at this thread
http://www.qtcentre.org/forum/showthread.php?t=825
Sorry for this crossposting but I have been fighting with this problem far too long now.
Re: Need help installing.
The zip file you referred to was a mess (.QTApplication.zip) Some files had to be re-named etc.
The Example_Qtui.zip was not possible to compile. One include file was blank.
After messing with re-naming I could compile and run the files under QTApplication.zip. I did not encounter the problems you mention.
I generated new .pro file with new makefile with and compiled with gmake
Re: Need help installing.
So you've managed to get dev-c++ to work with this? I'm amazed. But you can't get it to compile without running qmake explicitly in a command window?
Re: Need help installing.
From the output of the compiler it looks like moc is not being called.
You need to create a pro file (in command line: qmake -project).
This will create a pro file.
Then you do a qmake <yourprofile.pro>, this will create a make file.
In Dev-C++ you need then, in the option tell the IDE to use that makefile with the current project.
Re: Need help installing.
And make sure you have a header file for your class containing Q_OBJECT. moc only searches header files for Q_OBJECT macro.