使用PostgreSQL编译静态Qt 5.10.0时出错 [英] Error while compiling static Qt 5.10.0 with PostgreSQL
问题描述
我试图在Windows 7上使用mingw用PostgreSQL 10(或9.2,但有相同的错误)编译Qt 5.10.0。
I'm trying to compile Qt 5.10.0 with PostgreSQL 10 (or 9.2, but same error) using mingw on Windows 7.
但是当我包括psql include和lib dirs在mingw32-make之后,我总是收到以下错误:
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
我在qt论坛上进行了搜索,发现有人存在相同的错误,但没有解决方法:
https://forum.qt.io/topic/66218/trubble -with-static-qt5-6-0-with-qt-sql-psql-compiling-from-source
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
我的configure命令如下所示:
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
如果删除
-I"C:\POSTGRESQL\10\include"
-L"C:\POSTGRESQL\10\lib"
但没有psql ob
but without psql obviously.
任何解决此问题的想法都将受到高度赞赏。
Any ideas on how to resolve this issue would be highly appreciated, thanks.
推荐答案
似乎您最近尚未构建Qt(第5.8版)- -I
和 -L $
It seems like you haven't built Qt recently (post 5.8) - the -I
and -L
configuration syntax is no longer supported.
对我来说,postgres可以正常工作,我只需要 -sql-psql
配置标志和系统路径中的库。
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
这篇关于使用PostgreSQL编译静态Qt 5.10.0时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!