Help Center/ GaussDB/ Developer Guide(Distributed_V2.0-2.x)/ Application Development Guide/ Development Based on libpq/ Development Process
Updated on 2025-08-19 GMT+08:00
Development Process
To compile and connect to a libpq source program, perform the following operations:
- Decompress the GaussDB-Kernel-VxxxRxxxCxx-xxxxx-64bit-Libpq.tar.gz file. The required header file is stored in the include folder, and the lib folder contains the required libpq library file.
In addition to libpq-fe.h, the include folder contains the header files postgres_ext.h, gs_thread.h, and gs_threadlocal.h by default. These three header files are the dependency files of libpq-fe.h.
- Include the libpq-fe.h header file.
#include <libpq-fe.h>
- Provide the -I directory option to provide the installation location of the header file. (Sometimes the compiler looks for the default directory, so this option can be ignored.) Example:
gcc -I (Directory where the header file is located) -L (Directory where the libpq library is located) testprog.c -lpq
- If the makefile is used, add the following option to variables CPPFLAGS, LDFLAGS, and LIBS:
CPPFLAGS += -I (Directory of the header file) LDFLAGS += -L (Directory of the libpq library) LIBS += -lpq
Parent topic: Development Based on libpq
What is your overall rating for this page?
0
1
2
3
4
5
6
7
8
9
10
Very dissatisfiedVery satisfied
Thank you very much for your feedback. We will continue working to improve the documentation.
The system is busy. Please try again later.