필터 지우기
필터 지우기

Connecting PostgreSQL with MATLAb using mex wrapper

조회 수: 2 (최근 30일)
Olivier
Olivier 2011년 5월 5일
I am trying to use a mex wrapper to connect the Matlab with PostgreSQL.
I am getting following error while compiling it on MATLAB
>> mex -DWindows -IC:\PostgreSQL\pgsql\include -LC:\PostgreSQL\pgsql\lib -lpq libpqmex.c
Writing library for libpqmex.mexw32
c:\docume~1\asalman\locals~1\temp\mex_76~1\libpqmex.obj .text: undefined reference to '_PQconnectdb'
c:\docume~1\asalman\locals~1\temp\mex_76~1\libpqmex.obj .text: undefined reference to '_PQstatus'
c:\docume~1\asalman\locals~1\temp\mex_76~1\libpqmex.obj .text: undefined reference to '_PQexec'
c:\docume~1\asalman\locals~1\temp\mex_76~1\libpqmex.obj .text: undefined reference to '_PQntuples'
c:\docume~1\asalman\locals~1\temp\mex_76~1\libpqmex.obj .text: undefined reference to '_PQnfields'
c:\docume~1\asalman\locals~1\temp\mex_76~1\libpqmex.obj .text: undefined reference to '_PQerrorMessage'
c:\docume~1\asalman\locals~1\temp\mex_76~1\libpqmex.obj .text: undefined reference to '_PQfinish'
c:\docume~1\asalman\locals~1\temp\mex_76~1\libpqmex.obj .text: undefined reference to '_PQgetvalue'
C:\PROGRA~1\MATLAB\R2011A\BIN\MEX.PL: Error: Link of 'libpqmex.mexw32' failed.
Please help me.
Thanks in advance
Regards
Sumit

채택된 답변

Chirag Gupta
Chirag Gupta 2011년 5월 5일
I was able to compile the program successfully using the following:
mex testfunction.c -IC:\MatlabWork\Answers\pgsql\include
-LC:\MatlabWork\Answers\pgsql\lib -lpq
Are you using a C++ compiler? That might be the issue here?
  댓글 수: 1
Olivier
Olivier 2011년 5월 10일
I have only one compiler set which is Lcc-win32 C 2.4.1 in C:\PROGRA~1\MATLAB\R2011a\sys\lcc
should i change it ??

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Olivier
Olivier 2011년 5월 10일
I have only one compiler set which is Lcc-win32 C 2.4.1 in C:\PROGRA~1\MATLAB\R2011a\sys\lcc should i change it ??

카테고리

Help CenterFile Exchange에서 Write C Functions Callable from MATLAB (MEX Files)에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by