So it looks like you'll need to build it indeed - its quite easy, just follow the link ChrisW67 gave you in previous post (there is QPSQL section).
So it looks like you'll need to build it indeed - its quite easy, just follow the link ChrisW67 gave you in previous post (there is QPSQL section).
I tried to build the psql plugin before,
but even there I need some support.
The doc says I have to use these commands
Qt Code:
cd %QTDIR%\src\plugins\sqldrivers\psql qmake "INCLUDEPATH+=C:\psql\include" "LIBS+=C:\psql\lib\ms\libpq.lib" psql.pro nmakeTo copy to clipboard, switch view to plain text mode
when I type the second command (yes I used the right path for psql) I get no error but the psql.pro file is still empty.
when I type the nmake my windows tells me it cannot find nmake. And I can't find nmake in the qt directory either.
At this point I have to say, thanks for your effort and patience.
I think the "problem" is a missing PostgreSQL dll, not the Qt driver. The driver also needs the dll.
Stampede spake saying:
and WilliamSpiderWeb wrote earlier:The thing is that this plugin is probably already built ( qsqlpsql.dll exisits in his Qt installation ).
and gave us error messages from the GNU ld, i.e. the MingW compiler suite.I got the lib from a friend of mine. He used it to communicate to a postgres db with a Visual C++ project (without MFC).
It took this to mean that his friend built the plugin with MSVC, and that WilliamSpiderWeb is using MingW. This plugin will not load into a MingW-built program for a variety of reasons. That's why I suggested building the plugin. Perhaps someone else can tell us if PostgreSQL would also have to built with MingW or if the downloadable binaries are sufficient?
To address one of the plugin build issues...
nmake is the make utility from the MSVC compiler suite. You are using the MingW compiler bundled in the Qt SDK. The equivalent command would be:
ChrisW67, you are probably right, I just assumed that the qt plugin was built during Qt installation.
I've just downloaded PostgreSQL from here : link (Binaries from installer version 8.4.7-1 for Windows), and it took me 30 sec. to build the plugin (g++ 4.5.2):
Just make sure that path in INCLUDEPATH and LIBS is correct.Qt Code:
cd C:\Qt\src\plugins\sqldrivers\psql qmake "INCLUDEPATH+=C:\pgsql\include" "LIBS+=C:\pgsql\lib\libpq.lib" psql.pro makeTo copy to clipboard, switch view to plain text mode
I'm not sure what I am doing wrong.
I started cmd, then moved to the directory "..\src\plugin\sqldrivers\psql".
The psql-folder was just created by me.
Now I typed the following command.
The error message I get isQt Code:
c:\qt\2010.05\qt\qmake\qmake.exe "INCLUDEPATH+=C:\psql9\include" "LIBS+=C:\psql9\lib\libpg.lib" psql.proTo copy to clipboard, switch view to plain text mode
When I create an empty textfile or copy an existing *.pro file to the directory "...sqldrivers\psql" I get the following error messageCannot find file: psql.pro
QMAKESPEC has not been set, so configuration cannot be deduced.
Error processing project file: psql.pro
Am I on the completly wrong way?
I want my qt App communicate with a postgresql database.
Chris and stampede told me I have to build a psql plugin for qt.
That's what I'm actually trying to do.
Qt Code:
cd C:\Qt\src\plugins\sqldrivers\psql qmake "INCLUDEPATH+=C:\pgsql\include" "LIBS+=C:\pgsql\lib\libpq.lib" psql.pro makeTo copy to clipboard, switch view to plain text mode
If I just type qmake, my pc cannot find the command. That's why I typed the whole path of qmake.exe.
And postgres is installed in C:\psql9 on my computer.
And as you can read in my last reply, it doesn't work on my computer.
And you intend to do it by compiling a project from a directory that doesn't contain any source (nor other project) files? You expect some magic to happen that your compiler knows how to build that plugin from an empty directory?
You shouldn't be creating any directories. Qt sources should contain a psql directory inside src/plugins/imageformats and there should be a bunch of files there including a README file containing requirements and instructions for building the plugin.The psql-folder was just created by me.
I expected no kind of magic. But as you know that thread is posted in -Newbie- Forum. It's my first qt project and noone tells you what qmake and nmake are supposed to do. So I could be that qmake creates the psql.pro...
Anyway, now I know that it works in a different way.
I think my problem was I had installed the "qt sdk 2010.05" and the "qt 4.7.2". And in one folder the folder "...\qt\src\plugins\sqldrivers\psql" exists and in one not.
Now I've found the psql-project and the qmake-command seems to work.
But when I use mingw32-make.exe I get errors again.
The German expression in the cmd-output means:C:/qt/2010.05/mingw/bin/mingw32-make -f Makefile.Debug all
mingw32-make[1]: Entering directory 'C:/Qt/2010.05/qt/src/plugins/sqldrivers/psql'
g++ -c -g -frtti -fexeptions -mthreads - Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_DLL -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I "..\..\..\..\include\QtCore" -I"..\..\..\..\include\QtSql" -I"..\..\..\..\include" -I"c:\psql9\include" -I"..\..\..\..\include\ActiveQt" -I"tmp\moc\debug_shared" -I"..\..\..\..\mkspecs\win32-g++" -o tmp\obj\debug_shared\main.o main.cpp
Der Befehl "g++" ist entweder falsch geschrieben oder konnte nicht gefunden werden
mingw32-make[1]: *** [tmp/obj/debug_shared/main.o] Error 1
mingw32-make[1]: Leaving directory 'C:/Qt/2010.05/qt/src/plugins/sqldrivers/psql'
mingw32-make: *** [debug-all] Error 2
I haven't chosen something with g++.The command "g++" is wrong spelled or does not exist
Please help me again.
If you look at the description of the forum you'll notice it says "Newbie to Qt", not "Newbie to programming".
The docs for Qt and Visual Studio should tell you that. You can't expect to have zero knowledge about something and immediately use it to its full potential. Maybe your first Qt project should be something simpler than accessing databases.It's my first qt project and noone tells you what qmake and nmake are supposed to do.
Please learn to use a compiler.But when I use mingw32-make.exe I get errors again.
The German expression in the cmd-output means:
I haven't chosen something with g++.
Please help me again.
That's not my first programming project at all.
Your post was not that helpful.
I don't know why you are going to do verbal attacks against me.
Bookmarks