libraries

Hello! I continue to suffer with the included files and libraries. I can't understand, why there is a following error:
>> mex -IC:\OgreSDK\samples\include -IC:\OgreSDK\include -LC:\OgreSDK\lib OgreAppSource.cpp -l OgreMain_d.lib -l OIS_d.lib
Warning: MEX could not find the library "" specified with -l option.
MEX looked for a file with one of the names:
.lib
lib.lib
MEX looked for the library in the following directories:
C:\Program Files\Microsoft Visual Studio 9.0\VC\ATLMFC\LIB
C:\Program Files\Microsoft Visual Studio 9.0\VC\LIB
C:\Program Files\\Microsoft SDKs\Windows\v6.0A\lib
C:\Program Files\Microsoft Visual Studio 9.0\SDK\v2.0\lib
C:\Program Files\MATLAB\R2010b\extern\lib\win32
C:\Program Files\SQLXML 4.0\bin\
C:\Program Files\MATLAB\R2010b\extern\lib\win32\microsoft
C:\OgreSDK\lib
Warning: MEX could not find the library "" specified with -l option.
MEX looked for a file with one of the names:
.lib
lib.lib
MEX looked for the library in the following directories:
C:\Program Files\Microsoft Visual Studio 9.0\VC\ATLMFC\LIB
C:\Program Files\Microsoft Visual Studio 9.0\VC\LIB
C:\Program Files\\Microsoft SDKs\Windows\v6.0A\lib
C:\Program Files\Microsoft Visual Studio 9.0\SDK\v2.0\lib
C:\Program Files\MATLAB\R2010b\extern\lib\win32
C:\Program Files\SQLXML 4.0\bin\
C:\Program Files\MATLAB\R2010b\extern\lib\win32\microsoft
C:\OgreSDK\lib
LINK : fatal error LNK1181: cannot open input file 'OgreMain_d.lib'
C:\PROGRA~1\MATLAB\R2010B\BIN\MEX.PL: Error: Link of 'OgreAppSource.mexw32' failed.
??? Error using ==> mex at 208
Unable to complete successfully.
I will be grateful for any help.

 Risposta accettata

Kaustubha Govind
Kaustubha Govind il 5 Apr 2011

0 voti

I'm sorry, I think I made a mistake in my answer to your previous question - there should be no blankspace between -l and your library name. Also, you don't need to add the .lib extension since MEX does that automatically for you. Try:
>> mex -IC:\OgreSDK\samples\include -IC:\OgreSDK\include -LC:\OgreSDK\lib OgreAppSource.cpp -lOgreMain_d -lOIS_d

3 Commenti

Natalia
Natalia il 5 Apr 2011
I am running the mex command from the directory where is my source file OgreAppSource.cpp.
Thank you, Kaustubha, but I have faced a new problem
>> mex -IC:\OgreSDK\samples\include -IC:\OgreSDK\include -LC:\OgreSDK\lib OgreAppSource.cpp -lOgreMain_d -lOIS_d
LINK : error LNK2001: unresolved external symbol mexFunction
C:\Users\98AF~1\AppData\Local\Temp\mex_C4W8i8\templib.x : fatal error LNK1120: 1 unresolved externals
C:\PROGRA~1\MATLAB\R2010B\BIN\MEX.PL: Error: Link of 'OgreAppSource.mexw32' failed.
??? Error using ==> mex at 208
Unable to complete successfully.
The code(which I try to make mex)has no problems in visual studio 2008. If it is necessary, I am ready to lay out source codes...
Very,very much grateful
Natalia
Kaustubha Govind
Kaustubha Govind il 6 Apr 2011
Okay, so it appears that OgreAppSource.cpp is not really a MEX-function (remember that a MEX-function has not main(), but a mexFunction()instead) - I am assuming that you build an executable from this file in Visual Studio, which is why it works. But MEX actually produces a DLL-like binary, and needs a different interface. You will need to modify your source code and create a MEX wrapper around it.
Natalia
Natalia il 6 Apr 2011
Thank you, many, many :)

Accedi per commentare.

Più risposte (1)

Arnaud Miege
Arnaud Miege il 5 Apr 2011

0 voti

The error message seems to suggest that mex can't find the file OgreMain_d.lib. Are you sure this file is on your MATLAB path or in your current directory?
HTH,
Arnaud

3 Commenti

Natalia
Natalia il 5 Apr 2011
Yes, I am sure. The file 'OgreMain_d.lib' is in a folder C:\OgreSDK\lib. I have checked up names.
Arnaud Miege
Arnaud Miege il 5 Apr 2011
OK, but from which directory are you running the mex command? Shouldn't you have:
>> mex -IC:\OgreSDK\samples\include -IC:\OgreSDK\include -LC:\OgreSDK\lib OgreAppSource.cpp -l C:\OgreSDK\lib\OgreMain_d.lib -l OIS_d.lib
HTH,
Arnaud
Natalia
Natalia il 6 Apr 2011
Has changed nothing

Accedi per commentare.

Categorie

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by