postgresql 我从哪里获得 libpq 源代码?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1244778/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Where do I get libpq source?
提问by Raviprakash
I want to write application which uses Postgresql as DBMS. To write client application do I need libpq library and header files? If yes where I would get libpq library and header files.
我想编写使用 Postgresql 作为 DBMS 的应用程序。要编写客户端应用程序,我需要 libpq 库和头文件吗?如果是,我将在哪里获得 libpq 库和头文件。
回答by Sadegh
Libpq is included in the full PostgreSQL source code. You can use just libpq without the rest of PostgreSQL, but must download the full package.
Libpq 包含在完整的 PostgreSQL 源代码中。你可以只使用 libpq 而没有 PostgreSQL 的其余部分,但必须下载完整的包。
You can download it from the PostgreSQL Downloads page.
您可以从PostgreSQL 下载页面下载它。
Once you extract the full package it is inside src\interfaces\libpq
.
一旦你提取了完整的包,它就在里面src\interfaces\libpq
。
The PostgreSQL installation guidedetails how to install only the client libraries in the Installationsection, under Client-only installation.
该PostgreSQL安装指南详细介绍了如何只安装在客户端库安装部分,在只有客户端的安装。
Libpq documentationis also available.
Libpq 文档也可用。
回答by Andrejs Cainikovs
In postgresql sources, src\interfaces\libpq.
And yes, it is possible to compile only the libpq.
在 postgresql 源代码中,src\interfaces\libpq。
是的,可以只编译 libpq。
回答by Elyor
For Windows users, it's in (version may be different)
对于 Windows 用户,它在(版本可能不同)
C:\Program Files\PostgreSQL\lib
There you find libpq.lib
. Provide this directory to Linker input.
Don't forget to include C:\Program Files\PostgreSQL\11\include
directory for include directories.
你找到了libpq.lib
。将此目录提供给链接器输入。不要忘记为包含C:\Program Files\PostgreSQL\11\include
目录包含目录。
回答by Amit Bisht
I was also facing this issue but didn't got a clear answer:
This issue clearly states that while installing diesel-cli system is not able to locate libpq.lib
我也面临这个问题,但没有得到明确的答案:
这个问题明确指出,在安装柴油 cli 系统时无法定位libpq.lib
First of all you should have a Postgre installed on your machine.
Also diesel require visual c++, thus download and install it if not already, the size of setup will be ~5gb.
Once above installations are done you need to setup environment variables:
首先,你应该在你的机器上安装了 Postgre。
柴油也需要visual c++,因此如果还没有下载并安装它,安装的大小将是~5gb。
完成上述安装后,您需要设置环境变量:
In my case path of postgres installation is C:\Program Files\PostgreSQL
thus add 2 environment variable path under User variables
add new in Path
where your libpq.lib
is located in my case it is available in both C:\Program Files\PostgreSQL\12\lib
and C:\Program Files\PostgreSQL\12\bin
在Postgres的安装我的情况下,路径C:\Program Files\PostgreSQL
从而增加在2环境变量PATHUser variables
中添加新的Path
地方您libpq.lib
位于我的情况下,可在这两个C:\Program Files\PostgreSQL\12\lib
和C:\Program Files\PostgreSQL\12\bin
Once this is added create one more environment variable PQ_LIB_DIR
and set path as shown below
添加后,再创建一个环境变量PQ_LIB_DIR
并设置路径,如下所示
Note: Once done re-trigger the installation command in a new cmd window
Source: pq-sysand github-solution
注意:完成后在新的 cmd 窗口中重新触发安装命令
来源:pq-sys和github-solution