database.sarang.net
UserID
Passwd
Database
DBMS
MySQL
ㆍPostgreSQL
Firebird
Oracle
Informix
Sybase
MS-SQL
DB2
Cache
CUBRID
LDAP
ALTIBASE
Tibero
DB 문서들
스터디
Community
공지사항
자유게시판
구인|구직
DSN 갤러리
도움주신분들
Admin
운영게시판
최근게시물
PostgreSQL Q&A 1037 게시물 읽기
No. 1037
예제 프로그램을 컴파일 해봤는데 define이 안되었다고 에러가......
작성자
나그네
작성일
2000-05-17 17:45
조회수
13,528

아래의 예제프로그램을 컴파일 해보았는데 에러가뜨네요..

분명이 헤더파일은 /usr/include/pgsql/libpq/fe.h 에

있는데 말이에요... 도와주세요..

에러내용은 다음과 같아요...

db3.c: In function `main':

db3.c:37: warning: assignment makes pointer from integer without a cast

/tmp/ccXf6woP.o: In function `exit_nicely':

/tmp/ccXf6woP.o(.text+0x8): undefined reference to `PQfinish'

/tmp/ccXf6woP.o: In function `main':

/tmp/ccXf6woP.o(.text+0x6f): undefined reference to `PQsetdbLogin'

/tmp/ccXf6woP.o(.text+0x80): undefined reference to `PQstatus'

/tmp/ccXf6woP.o(.text+0xaa): undefined reference to `PQerrorMessage'

/tmp/ccXf6woP.o(.text+0xdd): undefined reference to `PQexec'

/tmp/ccXf6woP.o(.text+0xf4): undefined reference to `PQresultStatus'

/tmp/ccXf6woP.o(.text+0x11c): undefined reference to `PQclear'

/tmp/ccXf6woP.o(.text+0x134): undefined reference to `PQclear'

/tmp/ccXf6woP.o(.text+0x153): undefined reference to `PQconsumeInput'

/tmp/ccXf6woP.o(.text+0x165): undefined reference to `PQnotifies'

/tmp/ccXf6woP.o(.text+0x1b7): undefined reference to `PQfinish'

collect2: ld returned 1 exit status

////////////////////////////////////////////////////////////////////////////

 

#include <stdio.h>

#include "pgsql/libpq/fe.h"

 

void

exit_nicely(PGconn *conn)

{

PQfinish(conn);

exit(1);

}

 

main()

{

char *pghost,

*pgport,

*pgoptions,

*pgtty;

char *dbName;

int nFields;

int i,

j;

 

PGconn *conn;

PGresult *res;

PGnotify *notify;

 

/*

* begin, by setting the parameters for a backend connection if the

* parameters are null, then the system will try to use reasonable

* defaults by looking up environment variables or, failing that,

* using hardwired constants

*/

pghost = NULL; /* host name of the backend server */

pgport = NULL; /* port of the backend server */

pgoptions = NULL; /* special options to start up the backend

* server */

pgtty = NULL; /* debugging tty for the backend server */

dbName = getenv("USER"); /* change this to the name of your test

* database */

 

/* make a connection to the database */

conn = PQsetdb(pghost, pgport, pgoptions, pgtty, dbName);

 

/*

* check to see that the backend connection was successfully made

*/

if (PQstatus(conn) == CONNECTION_BAD)

{

fprintf(stderr, "Connection to database '%s' failed.\n", dbName);

fprintf(stderr, "%s", PQerrorMessage(conn));

exit_nicely(conn);

}

 

res = PQexec(conn, "LISTEN TBL2");

if (!res || PQresultStatus(res) != PGRES_COMMAND_OK)

{

fprintf(stderr, "LISTEN command failed\n");

PQclear(res);

exit_nicely(conn);

}

 

/*

* should PQclear PGresult whenever it is no longer needed to avoid

* memory leaks

*/

PQclear(res);

 

while (1)

{

 

/*

* wait a little bit between checks; waiting with select()

* would be more efficient.

*/

sleep(1);

/* collect any asynchronous backend messages */

PQconsumeInput(conn);

/* check for asynchronous notify messages */

while ((notify = PQnotifies(conn)) != NULL)

{

fprintf(stderr,

"ASYNC NOTIFY of '%s' from backend pid '%d' received\n",

notify/>relname, notify/>be_pid);

free(notify);

}

}

 

/* close the connection to the database and cleanup */

PQfinish(conn);

 

}

[Top]
No.
제목
작성자
작성일
조회
1044흥미로운 기능 EXPLAIN 그리고 SQL중독증...
Coral
2000-05-18
13520
1041vacuum이 뭐에여????? ^^;
김종혁
2000-05-18
14831
1042┕>Re: vacuum이 뭐에여????? ^^;
정재익
2000-05-18 01:55:44
15971
1039POSTMASTER가 자꾸 죽어요!!!!!!!
박준희
2000-05-17
13147
1043┕>Re: POSTMASTER가 자꾸 죽어요!!!!!!!
정재익
2000-05-18 03:53:19
14939
1037예제 프로그램을 컴파일 해봤는데 define이 안되었다고 에러가......
나그네
2000-05-17
13528
1038┕>Re: 예제 프로그램을 컴파일 해봤는데 define이 안되었다고 에러가...
Coral
2000-05-17 18:01:34
14342
1048 ┕>Re: Re: 예제 프로그램을 컴파일 해봤는데 define이 안되었다고 에러가...
소몰이
2000-05-18 17:24:30
14843
1035sql문에서 에러가........
김종혁
2000-05-17
15639
1036┕>Re: sql문에서 에러가........
정재익
2000-05-17 13:39:32
16613
1040 ┕>Re: Re: sql문에서 에러가........
김종혁
2000-05-18 00:12:39
15616
1045  ┕>Re: Re: Re: sql문에서 에러가........
Coral
2000-05-18 11:02:39
16842
1030php에서 널값이 오면 break되는 문장에서요..?
성호
2000-05-16
15095
1031┕>Re: php에서 널값이 오면 break되는 문장에서요..?
정재익
2000-05-16 17:19:39
15054
1029v6.5.x에서 v7.0으로 업그레이드...
초보자
2000-05-16
15767
1032┕>Re: v6.5.x에서 v7.0으로 업그레이드...
정재익
2000-05-16 17:22:57
16777
1033 ┕>Re: Re: v6.5.x에서 v7.0으로 업그레이드...
Coral
2000-05-16 21:38:01
16744
1034  ┕>Re: Re: Re: v6.5.x에서 v7.0으로 업그레이드...
정재익
2000-05-17 00:16:03
16893
Valid XHTML 1.0!
All about the DATABASE... Copyleft 1999-2024 DSN, All rights reserved.
작업시간: 0.020초, 이곳 서비스는
	PostgreSQL v16.2로 자료를 관리합니다