Ask Your Question
0

How can I resolve the issue of not finding the file or directory libpq-fe.h on Ubuntu 20?

asked 2022-03-31 11:00:00 +0000

david gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-07-08 05:00:00 +0000

woof gravatar image

You can resolve this issue by following these steps:

  1. Install the PostgreSQL development package:

    sudo apt-get update
    sudo apt-get install postgresql-server-dev-all
    
  2. Check if libpq-fe.h file exists:

    find /usr -name libpq-fe.h
    

    If the file is found, note the path and proceed to step 3. If not, try installing the package again.

  3. Export the header file directory path:

    export C_INCLUDE_PATH=/usr/include/postgresql/
    
  4. Compile your program and link it with the PostgreSQL library:

    gcc -o program program.c -lpq
    

    Replace "program" with your program name and "program.c" with your program file name.

  5. Run your program:

    ./program
    
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2022-03-31 11:00:00 +0000

Seen: 11 times

Last updated: Jul 08 '21