-2

i created a new project and copy libpq.lib and header in specific directory of my project. I also add linker destination but when i build i get an undefined reference.

So i forgot something but what ?

sviardot
  • 17
  • 1
  • Welcome to SO. Things you forgot are more details. Missing are e.g. your system, your OS, your compiler, the actual commands you entered, the actual output of your compiler. – Aiyion.Prime Mar 22 '20 at 09:56
  • system => windows 10 compiler gcc and trying to build – sviardot Mar 22 '20 at 10:28
  • -------------- Build: Debug in PGlib (compiler: GNU GCC Compiler)--------------- mingw32-g++.exe -Llib -L"..\..\Program Files\PostgreSQL\10\lib" -o bin\Debug\PGlib.exe obj\Debug\main.o obj\Debug\src\cBase.o -llibpq obj\Debug\src\cBase.o: In function `ZN5cBaseC2ENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES5_S5_': D:/Dev/PGlib/src/cBase.cpp:10: undefined reference to `PQconnectdb' collect2.exe: error: ld returned 1 exit status Process terminated with status 1 (0 minute(s), 0 second(s)) 2 error(s), 0 warning(s) (0 minute(s), 0 second(s)) – sviardot Mar 22 '20 at 21:20
  • #include #include cBase::cBase(string DbName,string UserLogin,string PassWord) { m_DbName = DbName; m_UserLogin = UserLogin; m_PassWord = PassWord; const char *conninfo = "hostaddr = '127.0.0.1' dbname = 'Serveur_Atlantis' user = 'MyUser' password = 'MonMDP'"; PGconn *conn = PQconnectdb(conninfo); } – sviardot Mar 22 '20 at 21:21

1 Answers1

0

I found the problem ! Code blocks is a 32 bits version and Postgrel in 64. So i get the 32 bits binaries from https://www.enterprisedb.com/download-postgresql-binaries and its work.

sviardot
  • 17
  • 1