Thread Subject: Compiling MEX-file with external library

Subject: Compiling MEX-file with external library

From: Ralf

Date: 29 Oct, 2009 15:36:14

Message: 1 of 5

Hello all,

I am trying to compile a MEX-file, which uses an external library
function. The library is available as "tcdlls.lib".

But performing the compilation I get the following error. I have tried
also copying the .lib file to the working directory, but this did not
help. The library-file is correctly spelled. Using Visual Studio or
LCC-compiler did not make any difference. What is going wrong?

Thank you very much,
Ralf

>> mex timestwo.c -ltcdlls.lib -L"D:\Eigene Dateien\LibPath\"

Warning: MEX could not find the library "tcdlls.lib"
         specified with -l option on the path specified
         with the -L option.
   Bibliothek ".......\templib.x" und Objekt ".......\templib.exp"
werden erstellt.
timestwo.obj : error LNK2019: Verweis auf nicht aufgelöstes externes
Symbol (unresolved external symbol) "_tc_init_root" in Funktion
"_timestwo".
timestwo.mexw32 : fatal error LNK1120: 1 nicht aufgelöste externe
Verweise (unresolved external symbol).

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

??? Error using ==> mex at 221
Unable to complete successfully.

Subject: Compiling MEX-file with external library

From: roger

Date: 29 Oct, 2009 15:51:28

Message: 2 of 5

On Oct 29, 4:36 pm, Ralf <meteora...@gmx.net> wrote:
> Hello all,
>
> I am trying to compile a MEX-file, which uses an external library
> function. The library is available as "tcdlls.lib".
>
> But performing the compilation I get the following error. I have tried
> also copying the .lib file to the working directory, but this did not
> help. The library-file is correctly spelled. Using Visual Studio or
> LCC-compiler did not make any difference. What is going wrong?
>
> Thank you very much,
> Ralf
>
> >> mex timestwo.c -ltcdlls.lib -L"D:\Eigene Dateien\LibPath\"
>
> Warning: MEX could not find the library "tcdlls.lib"
>          specified with -l option on the path specified
>          with the -L option.
>    Bibliothek ".......\templib.x" und Objekt ".......\templib.exp"
> werden erstellt.
> timestwo.obj : error LNK2019: Verweis auf nicht aufgelöstes externes
> Symbol (unresolved external symbol) "_tc_init_root" in Funktion
> "_timestwo".
> timestwo.mexw32 : fatal error LNK1120: 1 nicht aufgelöste externe
> Verweise (unresolved external symbol).
>
>   C:\PROGRA~1\MATLAB\R2009B\BIN\MEX.PL: Error: Link of
> 'timestwo.mexw32' failed.
>
> ??? Error using ==> mex at 221
> Unable to complete successfully.

it is in fact a link error, not a compile error but that's not really
the point.
Where are the templib.x and templib.exp files located? are they on the
right path?
R

Subject: Compiling MEX-file with external library

From: James Tursa

Date: 29 Oct, 2009 16:49:02

Message: 3 of 5

Ralf <meteoradix@gmx.net> wrote in message <a23855e8-0d6f-4496-b672-014203e218e1@p15g2000vbl.googlegroups.com>...
>
> I am trying to compile a MEX-file, which uses an external library
> function. The library is available as "tcdlls.lib".
>
> I have tried
> also copying the .lib file to the working directory, but this did not
> help.

What mex command did you use when you tried this method? I would expect this to work:

mex timestwo.c tcdlls.lib

James Tursa

Subject: Compiling MEX-file with external library

From: Praetorian

Date: 29 Oct, 2009 17:18:16

Message: 4 of 5

On Oct 29, 10:49 am, "James Tursa"
<aclassyguy_with_a_k_not_...@hotmail.com> wrote:
> Ralf <meteora...@gmx.net> wrote in message <a23855e8-0d6f-4496-b672-014203e21...@p15g2000vbl.googlegroups.com>...
>
> > I am trying to compile a MEX-file, which uses an external library
> > function. The library is available as "tcdlls.lib".
>
> > I have tried
> > also copying the .lib file to the working directory, but this did not
> > help.
>
> What mex command did you use when you tried this method? I would expect this to work:
>
> mex timestwo.c tcdlls.lib
>
> James Tursa

Do as James suggested, do no use the -l or -L directives, just list
the .lib files along with the list of source files. You can either
copy the library to the working directory or enter the path to
wherever it is located.

HTH,
Ashish.

Subject: Compiling MEX-file with external library

From: Ralf

Date: 30 Oct, 2009 07:22:34

Message: 5 of 5

On 29 Okt., 18:18, Praetorian <ashish.sadanan...@gmail.com> wrote:
> On Oct 29, 10:49 am, "James Tursa"
>
> <aclassyguy_with_a_k_not_...@hotmail.com> wrote:
> > Ralf <meteora...@gmx.net> wrote in message <a23855e8-0d6f-4496-b672-014203e21...@p15g2000vbl.googlegroups.com>...
>
> > > I am trying tocompilea MEX-file, which uses an external library
> > > function. The library is available as "tcdlls.lib".
>
> > > I have tried
> > > also copying the .lib file to the working directory, but this did not
> > > help.
>
> > What mex command did you use when you tried this method? I would expect this to work:
>
> > mex timestwo.c tcdlls.lib
>
> > James Tursa
>
> Do as James suggested, do no use the -l or -L directives, just list
> the .lib files along with the list of source files. You can either
> copy the library to the working directory or enter the path to
> wherever it is located.
>
> HTH,
> Ashish.

Thank you all,

using the commands

mex timestwo.c tcdlls.lib

or

mex timestwo.c "C:\......\tcdlls.lib"

works without problems.

Ralf

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com