J'ai écrit un programme simple. Voici un code:Problème g ++ avec l'option -l et PostgreSQL
#include <iostream>
#include <stdio.h>
#include <D:\Program Files\PostgreSQL\8.4\include\libpq-fe.h>
#include <string>
using namespace std;
int main()
{
PGconn *conn;
PGresult *res;
int rec_count;
int row;
int col;
cout << "ble ble: " << 8 << endl;
conn = PQconnectdb("dbname=db_pm host=localhost user=postgres password=postgres");
if (PQstatus(conn) == CONNECTION_BAD) {
puts("We were unable to connect to the database");
exit(0);
}
}
Je suis en train de se connecter avec PostgreSQL. Je compile ce code avec la commande suivante:
gcc -I/"d: \ Program Files \ PostgreSQL \" -L/"d: \ Program Files \ PostgreSQL \ 8.4 \ lib \" -lpq -o firstcpp. o firstcpp.cpp
Cette commande est à partir du site suivant: http://www.mkyong.com/database/how-to-building-postgresql-libpq-programs/
Et quand je compile, j'obtiens l'erreur suivante: /Cygnus/Cygwin-B20/H-i586-Cygwin32/i586-Cygwin32/bin/ld: impossible d'ouvrir -lpq: aucun fichier ou répertoire de ce type collect2: ld a renvoyé 1 statut de sortie
Est-ce que quelqu'un m'aider?
Difek
Qu'entend-on par les barres obliques après les drapeaux -L et -I? –