c++ - 为 postgresql 编译 libpqxx C++ 库时找不到 libpq-fe.h
问题描述
我正在尝试安装 libpqxx 库以使用 C++ 连接到 postgresDB,我正在使用 Msys 和 Mingw32。当我./configure
在 msys 控制台上运行时,我在控制台上收到此消息(如下)。当我检查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 变量中的间距,因此我没有在 Program files 文件夹中安装 postgres,而是创建了另一个名称中没有空格的文件夹,所以我的导出是这样PATH="$PATH:/c/MyPostgreSQLFOLDER/PostgreSQL/10/bin"
的,您可以随意命名文件夹不要在名称中包含任何空格。希望这可以帮助那里的任何人。
推荐阅读
- google-api - 我如何获得从我的应用程序产生的应用程序购买总收入?
- android - 如何在 Android 的 OkHttp 拦截器中处理 IOExceptions?
- .net - 从经典 .NET Framework 4.5 转换为 .NET 5.0
- symfony - 如何检查 symfony 服务器是否仍在运行?
- wpf - StackPanel.Orientation 的默认值是多少?
- python - NumPy:合并两个数组,以保存第一个数组中的所有值,但第二个数组中只有少数值
- linux - 如何在 KDE Plasma for Manjaro 中启用重音字符选项?
- c# - UnoPlatform Android 授予打开 USB 端口的权限
- php - VSCODE 缩进与 PHPIntellisense
- java - 在 Mac 上未安装 Java 问题