PDA

View Full Version : QSqlRecord problem



stevey
24th September 2006, 04:50
Hi,

I've been trying to make use of the QSqlQueryModel class to display items in a list view while retaining extra data that I need later on. This removes the need for another db call.

QSqlQueryModel has a function called 'record' which returns a QSqlRecord.
If I try to instantiate a QSqlRecord or any call which creates a QSqlRecord, ie the call to 'record' I get the following error when compiling:

Error 2 error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall QSqlRecord::~QSqlRecord(void)" (__imp_??1QSqlRecord@@QAE@XZ) referenced in function "private: void __thiscall ImageView::on_lwImages_clicked(class QModelIndex)" (?on_lwImages_clicked@ImageView@@AAEXVQModelIndex@ @@Z) imageview.obj

If I try to declare 'QSqlRecord *record;' then the build error isn't raised, it's only when a call to create the object is used.

I'm running 4.1.4 on Win32 in VS 2k5.
I actually built Qt with nmake from 2k3 so I thought maybe that was causing some problems. So I tried it in 2k3 and the issue was still there.

My 4.1.4 folder doesn't actually have the object file, only headers which explains the error, but my 4.2.0-snapshot-20060923 has the debug and release obj under /src/sql/tmp/obj.
4.2.0 was the release I was using when I found the problem, even though these obj's are there.

I'm building the MySql plugin in each version, and all other QSql module classes I've used are working, so can anyone suggest why these aren't being built / linked into the final libraries?



Thanks,

Steve

jacek
24th September 2006, 16:19
Does this error occur when you use Qt 4.1.4?

stevey
24th September 2006, 23:32
Yes.

Although I did try to create a fresh test project to see what would happen.
I think that the problem might relate to my project files.
I've been trying out recent snapshots of 4.2.0 and had to manually alter the .vcproj files Qt Version number. It wouldn't build against 4.2.0 unless I did that.
ut, I'm guessing somewhere along the line things have got a little messed up, and simply switching back to 4.1.4 isn't working.

I'll rebuild my project files today and see what happens.



Steve