简体   繁体   中英

Error while compiling static Qt 5.10.0 with PostgreSQL

I'm trying to compile Qt 5.10.0 with PostgreSQL 10 (or 9.2, but same error) using mingw on Windows 7.

However when I include the psql include and lib dirs I always get the following Error after mingw32-make:

g++ -c -fno-keep-inline-dllexport -O2 -std=c++1z -fno-exceptions -Wextra -Wall -
W -Wvla -Wdate-time -DUNICODE -D_UNICODE -DWINVER=0x0601 -D_WIN32_WINNT=0x0601 -
DQT_MOC -DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_FROM_BYTEARRAY -DQT_NO_COMPRESS -DQ
T_NO_FOREACH -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_USE_QSTRINGBUILDER -D
QT_NO_EXCEPTIONS -DQT_NO_DEBUG -DQT_BOOTSTRAP_LIB -DQT_VERSION_STR="\"5.10.0\""
-DQT_VERSION_MAJOR=5 -DQT_VERSION_MINOR=10 -DQT_VERSION_PATCH=0 -DQT_BOOTSTRAPPE
D -DQT_NO_CAST_TO_ASCII -I. -I. -I..\..\..\include -I..\..\..\include\QtCore -I.
.\..\..\include\QtCore\5.10.0 -I..\..\..\include\QtCore\5.10.0\QtCore -I..\..\..
\include\QtXml -I..\..\..\include\QtXml\5.10.0 -I..\..\..\include\QtXml\5.10.0\Q
tXml -IC:\POSTGRESQL\10\include -I..\..\..\mkspecs\win32-g++  -o .obj\release\m
oc.o moc.cpp
In file included from symbols.h:33:0,
                 from parser.h:32,
                 from moc.h:32,
                 from moc.cpp:30:
token.h:65:7: error: expected identifier before 'void'
     F(THIS) \
       ^
token.h:216:33: note: in definition of macro 'CREATE_ENUM_VALUE'
 #define CREATE_ENUM_VALUE(Name) Name,
                                 ^
 ...

token.h:263:1: error: expected declaration before '}' token
 };
 ^
Makefile.Release:314: recipe for target '.obj/release/moc.o' failed

I googled and found a thread on the qt forums where someone had the same Error, but no solution: https://forum.qt.io/topic/66218/trubble-with-static-qt5-6-0-with-qt-sql-psql-compiling-from-source

My configure command looks like this:

configure -prefix C:\Qt\Static\5.10.0 -static -release -nomake tests -nomake   examples -confirm-license -I"C:\POSTGRESQL\10\include" -L"C:\POSTGRESQL\10\lib" -opensource -qt-zlib -qt-libpng -qt-libjpeg -sql-psql -opengl desktop

the compilation works just fine if I remove

-I"C:\POSTGRESQL\10\include"
-L"C:\POSTGRESQL\10\lib"

but without psql obviously.

Any ideas on how to resolve this issue would be highly appreciated, thanks.

It seems like you haven't built Qt recently (post 5.8) - the -I and -L configuration syntax is no longer supported.

For me postgres just works, all I need is the -sql-psql configuration flag and the library in my system path.

If that alone doesn't work, you could specify the paths via the addition of the following configuration flags:

PSQL_INCDIR=C:\POSTGRESQL\10\include
PSQL_LIBDIR=C:\POSTGRESQL\10\lib

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM