PostgreSQL Error: The program can’t start because libpq.dll is missing from your computer

PostgreSQL Error: The program can’t start because libpq.dll is missing from your computer

PostgreSQL Error: The program can’t start because libpq.dll is missing from your computer

資料來源:http://stackoverflow.com/questions/20412084/postgresql-error-the-program-cant-start-because-libpq-dll-is-missing-from-your

 

The answer’s surprisingly simple.

The issue you’re seeing comes from the compiled application not being able to find the PostgreSQL libraries. The libpq.lib is used to compile the application, and it links to the DLL at run-time. You can either add it to your system wide path, or bundle the DLL with your application. (I’d add it on the development machine, and bundle the redistributable for a installer package.)

To include it in your path try:

Right click on “My Computer” and select Properties
Then Click on “Advanced System Settings”.
Click the “Environment Variables” button at the bottom of the dialog box.
It will pop up a dialog with a group box labeled “System Variables”. Find the one in the list box that has a Variable name of “Path”.
Now, add the path of the PostgreSQL library folder to the path with a “;” separator.
Now logout or reboot. It’s imperative that you at least log out of Windows and log back in for the Visual Studio debugger to pickup the additional executable module paths (that Path variable). Ideally, rebooting sends the new system path to all applications in the system at boot time.
If the Path variable has “C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem” in it, you would add “;C:\Program Files\PostgreSQL\libraries” to make it look like “C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Program Files\PostgreSQL\libraries”.

Be aware that your path will be really long in most cases. Just add it to the end.

Good luck!

 

 

發表迴響

你的電子郵件位址並不會被公開。 必要欄位標記為 *