From: Enjie Dorj on
Hello all,

I am trying to compile a MEX-file (qp.c ), which calls C native code.
The native code is available as "pr_logo.c".

But performing the compilation I get the following error. I have tried
also copying the pr_logo.c and pr_logo.h files to the working directory, but this did not help.

Using Visual Studio or LCC-compiler did not make any difference. What is going wrong?

Thank you very much,
Enkhjargal

>> mex qp.c
Creating library C:\DOCUME~1\ENKHEE\LOCALS~1\TEMP\MEX_NP~1\templib.x and object C:\DOCUME~1\ENKHEE\LOCALS~1\TEMP\MEX_NP~1\templib.exp
qp.obj : error LNK2019: unresolved external symbol _pr_loqo referenced in function _mexFunction
qp.mexw32 : fatal error LNK1120: 1 unresolved externals

C:\PROGRA~1\MATLAB\R2009B\BIN\MEX.PL: Error: Link of 'qp.mexw32' failed.

??? Error using ==> mex at 221
Unable to complete successfully.
From: Steve Conahan on

"Enjie Dorj" <files(a)mathworks.com> wrote in message
news:i1ifoh$pni$1(a)fred.mathworks.com...
> Hello all,
>
> I am trying to compile a MEX-file (qp.c ), which calls C native code. The
> native code is available as "pr_logo.c".
>
> But performing the compilation I get the following error. I have tried
> also copying the pr_logo.c and pr_logo.h files to the working directory,
> but this did not help.
> Using Visual Studio or LCC-compiler did not make any difference. What is
> going wrong?
>
> Thank you very much,
> Enkhjargal
>
>>> mex qp.c
> Creating library C:\DOCUME~1\ENKHEE\LOCALS~1\TEMP\MEX_NP~1\templib.x and
> object C:\DOCUME~1\ENKHEE\LOCALS~1\TEMP\MEX_NP~1\templib.exp qp.obj :
> error LNK2019: unresolved external symbol _pr_loqo referenced in function
> _mexFunction qp.mexw32 : fatal error LNK1120: 1 unresolved externals
> C:\PROGRA~1\MATLAB\R2009B\BIN\MEX.PL: Error: Link of 'qp.mexw32' failed.
> ??? Error using ==> mex at 221
> Unable to complete successfully.
>

Perhaps "pr_loqo" is a mis-spelled version of "pr_logo" somewhere in your
source code?

Steve


From: James Tursa on
"Enjie Dorj" <files(a)mathworks.com> wrote in message <i1ifoh$pni$1(a)fred.mathworks.com>...
>
> I am trying to compile a MEX-file (qp.c ), which calls C native code.
> The native code is available as "pr_logo.c".
>
> But performing the compilation I get the following error. I have tried
> also copying the pr_logo.c and pr_logo.h files to the working directory, but this did not help.
>
> Using Visual Studio or LCC-compiler did not make any difference. What is going wrong?
>
> Thank you very much,
> Enkhjargal
>
> >> mex qp.c
> Creating library C:\DOCUME~1\ENKHEE\LOCALS~1\TEMP\MEX_NP~1\templib.x and object C:\DOCUME~1\ENKHEE\LOCALS~1\TEMP\MEX_NP~1\templib.exp
> qp.obj : error LNK2019: unresolved external symbol _pr_loqo referenced in function _mexFunction
> qp.mexw32 : fatal error LNK1120: 1 unresolved externals
>
> C:\PROGRA~1\MATLAB\R2009B\BIN\MEX.PL: Error: Link of 'qp.mexw32' failed.
>
> ??? Error using ==> mex at 221
> Unable to complete successfully.

You need to include *all* source files on the mex command line unless they are explicitly #include in the C source itself. All files need to be in the current directory or you need to supply the full path to them. e.g.,

>> mex qp.c pr_logo.c


James Tursa