Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22476

Why can my C program run in "git bash", but not in "cmd"?

$
0
0

I wrote a demo using libpq to connect to a PostgreSQL database.

I tried to connect the C file to PostgreSQL by including

#include <libpq-fe.h>

after I added the paths into system variables I:\Program Files\PostgreSQL\12\lib as well as to I:\Program Files\PostgreSQL\12\include and compiled with this command:

gcc -Wall -Wextra -m64 -I "I:\Program Files\PostgreSQL\12\include" -L "I:\Program Files\PostgreSQL\12\lib" testpsql.c -lpq -o testpsql

It first raised three errors, like

libssl-1_1-x64.dll is missing
libintl-8.dll was missing
libcrypto-1_1-x64.dll was missing

After I downloaded these three files and put them into I:\Program Files\PostgreSQL\12\lib, and compiled it again, it shows the error

The application was unable to start correctly (0xc0150002)

when I type testpsql. But if I type ./testpsql on git bash, it works. Anyone can please tell me why?

The code that I used was the first example from here.

Environment: PostgreSQL 12, Windows 10, MinGW64


Viewing all articles
Browse latest Browse all 22476

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>