PDA

View Full Version : qDebug / qStringList - Problem



EMKAH
18th November 2012, 16:40
Hi there,

i tried to built a very simple application, just to test what SQL database plugins are installed:



#include <QtCore/QCoreApplication>
#include <QDebug>
#include <QtSql/QSqlDatabase>
#include <QStringList>

int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);

qDebug() << QSqlDatabase::drivers();


return a.exec();
}


This is all the code i've written. I know that this code worked in former versions of Qt, but now, it doesn't anymore. When I try to compile, i get this "symbol(s) not found for architecture x86_64" error.

Here's the complete output:



make: Entering directory `/.../MyProject-build-Desktop-Debug'
cd subProject/ && /usr/bin/make -f Makefile
make[1]: Entering directory `/.../My-build-Desktop-Debug/subProject'
g++ -headerpad_max_install_names -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5 -o dsp_Server main.o -F/Library/Frameworks -L/Library/Frameworks -framework QtCore
Undefined symbols for architecture x86_64:
"QSqlDatabase::drivers()", referenced from:
_main in main.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make[1]: *** [dsp_Server] Error 1
make[1]: Leaving directory `/.../MyProject-build-Desktop-Debug/subProject'
make: Leaving directory `/.../MyProject-build-Desktop-Debug'
make: *** [subProject-make_default] Error 2
17:38:12: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project MyProject (target: Desktop)
When executing step 'Make'


I'm using Qt 4.8.2 under OS X 10.8.2. Can anybody help?

Thanks,
Markus

EDIT: Sorry for misfitting title... Before this problem occured, i had problems because i forgot to add the #include <QStringList> line (which also wasn't necessary the last time i used Qt)...

amleto
18th November 2012, 21:09
how did you build Qt? with g++ and -arch x86_64?

wagmare
19th November 2012, 05:31
Not sure.. but looks like 32bit, 64 bit problem ..may be. create the project file .pro freshly .. just a suggestion ...

EMKAH
19th November 2012, 09:51
how did you build Qt? with g++ and -arch x86_64?

I installed the ready-to-use dmg image.


Not sure.. but looks like 32bit, 64 bit problem ..may be. create the project file .pro freshly .. just a suggestion ...

This is my .pro file:



QT += core

QT -= gui

TARGET = subProject
CONFIG += console
CONFIG -= app_bundle

TEMPLATE = app


SOURCES += main.cpp


When I add the line
CONFIG -= x86_64, it still throws the same error message (I cleaned everything before).

anda_skoa
19th November 2012, 14:49
Looks like you are missing the sql module in your QT config line

QT += sql

Cheers,
_

EMKAH
19th November 2012, 16:50
*...* Damn. :D I tried this with QT += network already...

Thanks A LOT!!! This did cost me over 3 hours of frustration...