[Qt-interest] subclassing Sql drivers (linking issue)

Andre Somers andre at familiesomers.nl
Tue Feb 23 17:27:22 CET 2010


Thiago Macieira wrote:
> Em Terça-feira 23 Fevereiro 2010, às 16:22:28, Andre Somers escreveu:
>   
>> Andre Somers wrote:
>>     
>>> Andre Somers wrote:
>>>       
>>>> Hi,
>>>>
>>>> I am trying to extend the Qt SQL drivers to add some functionality. I
>>>> have the thing compiling, but I run into a problem when linking. I get
>>>> lots of "undefined reference" errors like these:
>>>>         
> Change Qt code and recompile the driver.
>
> The driver is not a library. You cannot link to it.
Weird, since the project file says it is:

odbc.pro sets the target, and includes qsqldriverbase.pri
sqldriverbase.pri includes qpluginbase.pri
qpluginbase.pri contains TEMPLATE = lib

That would suggest that the driver *is* a lib. The mere fact that it 
results in a .dll (on windows) also suggests this.

Still, I managed to solve this a bit less elegantly by including the 
relevant parts of these .pro files into my own one, pulling in the Qt 
driver code into my own drivers. This frees me from having to re-modify 
the qt drivers time and time again with each qt version. At least as 
long as their .pro files remain stable... At least the thing compiles 
and links now, and the qt plugin mechanism seems to load the driver OK. 
Next up is making sure it actually works of course...

André





More information about the Qt-interest-old mailing list