在为 postgresql 编译 libpqxx C++ 库时找不到 libpq-fe.h

Cant find libpq-fe.h when compiling the libpqxx C++ library for postgresql

本文关键字:找不到 libpq-fe C++ postgresql 编译 libpqxx 在为      更新时间:2023-10-16

我试图安装 libpqxx 库以使用 C++ 连接到 postgresDB am 使用 Msys 和 Mingw32。当我在 msys 控制台上运行./configure时,我在控制台上收到此消息(如下)。当我签入pg_config --includedir目录时,我可以看到头文件libpq-fe.h在那里,我在哪里做错了什么。我在Windows平台上,我已经安装了postgres v.10,libpqxx版本是4.0,也是我确实设置的路径环境,因此导出PATH="$PATH:/c/Program Files/PostgreSQL/10/bin"

checking for pg_config... /c/Program Files/PostgreSQL/10/bin/pg_config
./configure: line 15928: /c/Program: No such file or directory
configure: using PostgreSQL headers at
./configure: line 15931: /c/Program: No such file or directory
configure: using PostgreSQL libraries at
checking for ANSI C header files... (cached) yes
checking ability to compile programs using the standard C library... yes
checking for library containing select... no
checking for main in -lws2_32... yes
checking /libpq-fe.h usability... no
checking /libpq-fe.h presence... no
checking for /libpq-fe.h... no
configure: error:
Can't find libpq-fe.h in .  Are you sure the libpq
    headers are installed correctly?  They should be in the directory returned by
    "pg_config --includedir".

我发现了问题所在,它是环境 PATH 变量中的间距,所以我没有在程序文件文件夹中安装 postgres,而是创建了另一个名称中没有空格的文件夹,所以我的导出是这样的PATH="$PATH:/c/MyPostgreSQLFOLDER/PostgreSQL/10/bin"您可以随意命名文件夹,只是名称中不包含任何空格。希望这对那里的任何人都有帮助。