Error loading a DLL library on MatLab r2014a (fatal error C1083)

4 次查看(过去 30 天)
Hello,
I am trying to load a DLL library (LibTiePie.dll) for an USB oscilloscope (TiePie HS5 from TiePie Engineering). I am using MatLab r2014a (64 bit) and Windows 7 (64 bit) with Microsoft SDK + .NET Environement and Visual Studio as a compiler. While executing loadlibrary, Matlab returns the following error:
Error using loadlibrary (line 422)
Failed to preprocess the input file.
Output from preprocessor is:libtiepiematlab.h
C:\Program Files\MATLAB\R2014a\extern\include\tmwtypes.h(41) : fatal error C1083: Cannot open include file: 'limits.h': No such file or directory
Error in LibTiePie.Library (line 34)
[notfound, warnings] = loadlibrary(obj.Name, 'libtiepiematlab.h', 'addheader', 'libtiepie');
Error in LibTiePieNeeded (line 21)
LibTiePie = LibTiePie.Library
I already tried several solutions to solve the problem:
  • Moving the header file limits.h from C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include to C:\Program Files\MATLAB\R2014a\extern\include where twmtypes.h is located. This resulted in an error an antoher header files, so I moved all the header files from the Visual Studio Include folder to the Matlab extern Include folder. This solved the C1083 error but generated a LINK error (LNK1104) that could be also solved by moving .lib files around. In the end I stopped at another LINK error (LNK2001) because I figured that it was an ugly way of solving the problem... And I put every files back to their original location.
  • I also tried moving the header files from C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include to C:\Program Files\Microsoft SDKs\Windows\v7.1\Include which had the same effect as the previous solution.
  • I tried to reinstall all Microsoft SDK + .NET Environement and Visual Studio, but the error is still there...
Also this library is working on another computer using the same compiler (Microsoft SDK + .NET Environement and Visual Studio) and Matlab r2013b, r2014a and r2014b... I don't know if that helps, but I also executed the loadlibrary function step by step and found out that the command line generating the error was:
[res,ccout]=system(preprocess_command);
I don't know if the problem comes from Matlab, or the Microsoft compiler or somewhere else... If someone has any ideas of how I can solve this problem that would help.
Thanks a lot!
  1 个评论
Philip Borghesani
Philip Borghesani 2015-8-12
Are the working systems also running 64 bit MATLAB? Something appears to be wrong with your compiler installation or mex -setup.

请先登录,再进行评论。

回答(1 个)

Varun Bhaskar
Varun Bhaskar 2015-8-11
Hello,
In order to isolate the root cause of the problem, try performing the following steps to see if the compiler is causing it:
1) Reset path for MATLAB :
>>restoredefaultpath
>>rehash toolboxcache
2) Try to load a sample library 'shrlibsample.h' shipped with MATLAB. You can find it in the following folder location:
C:\Program Files\MATLAB\R2014a\extern\examples\shrlib
3) You can also try to mex a sample file 'yprime.c' from the same folder location.
If above steps go through successfully, then the compiler is not the root cause of the issue.

类别

Help CenterFile Exchange 中查找有关 C Shared Library Integration 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by