I used the PostgreSQL as my data base and I am coding a c++ project, so I have to use the libpq to connect it.
I have already found the include file and lib file in the PostgreSQL file but there are too many files. I think I don't need to add them all.
For the include file, I just added libpq-fe.h
, pg_config_ext.h
and postgres_ext.h
, then I included the libpq-fe.h
, it seems that everything goes well, I can call some functions such as PQconnectdb
, PQexec
etc. But when I compile it, I get some LNK errors, meaning that I didn't add the right lib files.
I've tried to add libpq.lib
and libpq.dll
, but I still got the LNK errors.
Does someone know which lib files should I add?
I got this error because of the wrong version.
Here is a same problem which has been solved.