yes, even did them all:
qmake -project
qmake
make clean
make
yes, even did them all:
qmake -project
qmake
make clean
make
Did you use the qmake that corresponds to the specific version of Qt that you want to use. For example /usr/local/Qt4/bin/qmake in the latter case because your system may be ending up finding and using your systems Qt3 headers. Maybe you should try to use qmake with its fully qualified path and see what results come out of this.
/usr/local/Qt4/bin/qmake -project && /usr/local/Qt4/bin/qmake && make.
p.s. could you please attach the Makefile generated by qmake?
It has a lot of variables tha state where to find headers and libs.
Qt Code:
... INCPATH = -I/usr/local/Trolltech/Qt-4.4.0-snapshot-20071021/mkspecs/linux-g++ -I. -I/usr/local/Trolltech/Qt-4.4.0-snapshot-20071021/include/QtCore -I/usr/local/Trolltech/Qt-4.4.0-snapshot-20071021/include/QtCore -I/usr/local/Trolltech/Qt-4.4.0-snapshot-20071021/include/QtGui -I/usr/local/Trolltech/Qt-4.4.0-snapshot-20071021/include/QtGui -I/usr/local/Trolltech/Qt-4.4.0-snapshot-20071021/include -I. -I. -I. LINK = g++ LFLAGS = -Wl,-rpath,/usr/local/Trolltech/Qt-4.4.0-snapshot-20071021/lib LIBS = $(SUBLIBS) -L/usr/local/Trolltech/Qt-4.4.0-snapshot-20071021/lib -lQtGui -L/usr/local/Trolltech/Qt-4.4.0-snapshot-20071021/lib -L/usr/X11R6/lib -lpng -lSM -lICE -pthread -pthread -lXi -lXrender -lXrandr -lfreetype -lfontconfig -lXext -lX11 -lQtCore -lz -lm -pthread -lgthread-2.0 -lrt -lglib-2.0 -ldl -lpthread AR = ar cqs RANLIB = QMAKE = /usr/local/Trolltech/Qt-4.4.0-snapshot-20071021/bin/qmake ...To copy to clipboard, switch view to plain text mode
Last edited by momesana; 28th October 2007 at 07:02.
What does "qmake -v" output?
J-P Nurmi
Here is some output:
qmake -v
QMake version 2.01a
Using Qt version 4.3.2 in /usr/local/Qt4/lib
echo $PATH
/usr/local/Qt4/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games
Qt Code:
TEMPLATE = app TARGET = DEPENDPATH += . INCLUDEPATH += . ## The following line was manually inserted. QT = sql gui # Input HEADERS += areacodescombobox.h clientNotebook.h ../../userFunc.h FORMS += clientNotebook.ui SOURCES += areacodescombobox.cpp clientNotebook.cpp main.cpp ../../userFunc.cppTo copy to clipboard, switch view to plain text mode
Doesn't make any difference if I use full pathname to qmake.
This is full error message:
make /usr/local/Qt4/bin/uic clientNotebook.ui -o ui_clientNotebook.h
Warning: name layoutWidget is already used
g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_SQL_LIB -DQT_GUI_LIB -DQT_SHARED -I/usr/local/Qt4/mkspecs/linux-g++ -I. -I/usr/local/Qt4/include/QtGui -I/usr/local/Qt4/include/QtGui -I/usr/local/Qt4/include/QtSql -I/usr/local/Qt4/include/QtSql -I/usr/local/Qt4/include -I. -I. -I. -o areacodescombobox.o areacodescombobox.cpp
In file included from ./areacodescombobox.h:10,
from areacodescombobox.cpp:1:
./../../userFunc.h:7:19: error: QString: No such file or directory
./../../userFunc.h:8:23: error: QStringList: No such file or directory
make: *** [areacodescombobox.o] Error 1Qt Code:
// areacodescombobox.cpp #include "./areacodescombobox.h" ...To copy to clipboard, switch view to plain text mode
Qt Code:
// areacodescombobox.h #ifndef AREACODESCOMBOBOX_H #define AREACODESCOMBOBOX_H //#include <QWidget> #include <QtSql> #include <QSqlQuery> #include <QComboBox> #include <QApplication> #include <QMessageBox> #include "../../userFunc.h" { Q_OBJECT public: void initializeFields(); void setSelectedLocale(const QString& aSelectedLocale); void setSelectedAreacode(const QString& aSelectedAreacode); const QString& selectedLocale() const; const QString& selectedAreacode() const; private slots: void on_returnPressed(); private: QString vSelectedLocale; QString vSelectedAreacode; };To copy to clipboard, switch view to plain text mode
Qt Code:
/************************************************************************** * userFunc.h * Utility Functions **************************************************************************/ #ifndef USERFUNC_H #define USERFUNC_H #include <QString> #include <QStringList> //#include "/usr/local/Qt4/include/Qt/qstring.h" //#include "/usr/local/Qt4/include/Qt/qstringlist.h" #endifTo copy to clipboard, switch view to plain text mode
Do you include userFunc.h from another project's directory (i.e. something outside of your projects root directory) or does it belong to your current project?
If it is from an outside project you set INCLUDEPATH in your projects .pro file to point to the directory containing the mentioned header and use unqualifiled header includes.
Qt Code:
INCLUDEPATH += . /path/to/userFunc/To copy to clipboard, switch view to plain text mode
Qt Code:
#include <userFunc.h> instead of #include <../../userFunc.h>To copy to clipboard, switch view to plain text mode
Last edited by momesana; 28th October 2007 at 08:23.
It should be:
or simplyQT = core sql gui
(core and gui modules are enabled by default).QT += sql
J-P Nurmi
vieraci (28th October 2007)
I suppose you should add areacodescombobox.h and areacodescombobox.cpp to clientNotebook.pro.
J-P Nurmi
Yes the notebook part IS a plugin, and no, I didn't provide a constructor. I thought a default constructor might be provided by Qt... I just implemented the extra functions I need for the comboBox.
The .h file is in this post, this is the cpp file:
Qt Code:
void AreacodesCombobox::initializeFields() { setSelectedAreacode(blank); setSelectedLocale(blank); clear(); } void AreacodesCombobox::on_returnPressed() { { searchText.append(aLocale.trimmed().toUpper()); searchText.append("%' order by LOCALE"); clause.prepend("SELECT Areacode, Locale FROM AreacodesView WHERE "); clause.append(" Order by Locale"); if (query.isActive()) // successful execution { if (query.size()==0) { setFocus(); } else { clear(); while (query.next()) { addItem(locale); } if (query.size()==1) else { // comboBox()->select(1, true); } } } else { } // else if (model->query().isSelect()) // is a select statement } }To copy to clipboard, switch view to plain text mode
But template is "app" and it has main()..?
C++ compilers provide a default constructor in case you don't provide one. But in case you declare anything, you must also implement it:
Qt Code:
{ // ... }To copy to clipboard, switch view to plain text mode
In case that's really the full .cpp, looks like you're missing implementations of a bunch of other functions as well; setSelectedLocale(), setSelectedAreacode(), selectedLocale(), selectedAreacode().
J-P Nurmi
I created it by followed the example in the docs, now I can't find it, but from memory there was a "main" and template was "app"...but that probably doesn't mean it's correct.
But do I really need a constructor here ? there's nothing special I need to implement there, I'm just adding custom code.
Yes, they're implemented, seems I didn't select the whole file when I copied.
I actually was going to implement a constructor but thought about what I needed to do that was different, answer was "nothing" so I rem-ed it out.
Qt Code:
#include "./areacodescombobox.h" /* AreacodesCombobox::AreacodesCombobox() { } */ const QString& AreacodesCombobox::selectedLocale() const { return vSelectedLocale; } void AreacodesCombobox::setSelectedLocale(const QString& aSelectedLocale) { if (!(vSelectedLocale == aSelectedLocale)) { vSelectedLocale = aSelectedLocale; } } const QString& AreacodesCombobox::selectedAreacode() const { return vSelectedAreacode; } void AreacodesCombobox::setSelectedAreacode(const QString& aSelectedAreacode) { if (!(vSelectedAreacode == aSelectedAreacode)) { vSelectedAreacode = aSelectedAreacode; } } ...To copy to clipboard, switch view to plain text mode
The current project is a plugin of the main app,
the main app is in
projects/thisProject/src
the plugin is in
projects/thisProject/src/notebooks/clientNotebook
I tried your suggestion, no different.
Some more information:
The areacodesCombobox is a promoted QcomboBox widget in the clientNotebook widget.
If I use the full pathname to QString and compile, I get a different error. Don't know if this is important or just confuses things even more...
clientNotebook.o: In function `Ui_ClientNotebook::setupUi(QWidget*)':
clientNotebook.cpp.text._ZN17Ui_ClientNotebook7setupUiEP7QWidget[Ui_ClientNotebook::setupUi(QWidget*)]+0xf23): undefined reference to `AreacodesCombobox::AreacodesCombobox(QWidget*)'
clientNotebook.cpp.text._ZN17Ui_ClientNotebook7setupUiEP7QWidget[Ui_ClientNotebook::setupUi(QWidget*)]+0x3211): undefined reference to `AreacodesCombobox::AreacodesCombobox(QWidget*)'
clientNotebook.cpp.text._ZN17Ui_ClientNotebook7setupUiEP7QWidget[Ui_ClientNotebook::setupUi(QWidget*)]+0x37d7): undefined reference to `AreacodesCombobox::AreacodesCombobox(QWidget*)'
collect2: ld returned 1 exit status
make: *** [clientNotebook] Error 1
Bookmarks