Compiling mex files - Fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory

I've got an old mex file to run on my laptop and I got an error as in the title: Fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory. Mex is working without problem on another computer. I'm using 64-bit computer and 64-bit Matlab R2012b. To compile I have VS 2005. I've tried to change to VS 2010, but I've got more errors (four LNK2019). I was looking how to solve my problem, but nothing helps. I've stuck with it for 4 days.
I have a stdint.h file in folder with all files from project and on the path - doesn't work.
I've tried to show the location of the files as:
mex -l"C:\Users\Maria\Folder_with_project" mex_file.cpp
also:
mex -l"C:\Users\Maria\Folder_with_project\stdint.h" mex_file.cpp
I've tried also with -I (upper-version I) as includes.
In all cases there was the same error. Does anybody has any idea how to solve it?

10 Kommentare

I've done mex -setup, I choosed the compiler as VS 2005
Include directories should be indicated with -I which is upper-case letter I. -l (lower-case letter L) would be for individual library files, and -L (upper-case letter L) would be for naming library directories.
Please show us the output of
mex -v -I"C:\Users\Maria\Folder_with_project" mex_file.cpp
>> mex -v -I"C:\Users\tomograf\Documents\ASielecki_galvo\C___class_interface" galvo_class_mex.cpp
***************************************************************************
Warning: Neither -compatibleArrayDims nor -largeArrayDims is selected.
Using -compatibleArrayDims. In the future, MATLAB will require
the use of -largeArrayDims and remove the -compatibleArrayDims
option. For more information, see:
http://www.mathworks.com/help/techdoc/matlab_external/bsflnue-1.html
****************************************************************************
-> Default options filename found in C:\Users\tomograf\AppData\Roaming\MathWorks\MATLAB\R2012b
----------------------------------------------------------------
-> Options file = C:\Users\tomograf\AppData\Roaming\MathWorks\MATLAB\R2012b\mexopts.bat
MATLAB = C:\Program Files\MATLAB\R2012b
-> COMPILER = cl
-> Compiler flags:
COMPFLAGS = -c -GR -W3 -EHs -D_CRT_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_DEPRECATE -D_SECURE_SCL=0 -DMATLAB_MEX_FILE -nologo /MD
OPTIMFLAGS = -O2 -Oy- -DNDEBUG
DEBUGFLAGS = /Z7
arguments = -IC:\Users\tomograf\Documents\ASielecki_galvo\C___class_interface
Name switch = /Fo
-> Pre-linking commands =
-> LINKER = link
-> Link directives:
LINKFLAGS = /dll /export:mexFunction /LIBPATH:"C:\Program Files\MATLAB\R2012b\extern\lib\win64\microsoft" libmx.lib libmex.lib libmat.lib /MACHINE:AMD64 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /implib:"C:\Users\tomograf\AppData\Local\Temp\mex_awSe0o\templib.x" /MAP:"galvo_class_mex.mexw64.map" /nologo /incremental:NO
LINKDEBUGFLAGS = /DEBUG /PDB:"galvo_class_mex.mexw64.pdb"
LINKFLAGSPOST =
Name directive = /out:"galvo_class_mex.mexw64"
File link directive =
Lib. link directive =
Rsp file indicator = @
-> Resource Compiler = rc /fo "mexversion.res"
-> Resource Linker =
----------------------------------------------------------------
--> cl -IC:\Users\tomograf\Documents\ASielecki_galvo\C___class_interface -c -GR -W3 -EHs -D_CRT_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_DEPRECATE -D_SECURE_SCL=0 -DMATLAB_MEX_FILE -nologo /MD /FoC:\Users\tomograf\AppData\Local\Temp\mex_awSe0o\galvo_class_mex.obj -I"C:\Program Files\MATLAB\R2012b\extern\include" -I"C:\Program Files\MATLAB\R2012b\simulink\include" -O2 -Oy- -DNDEBUG -DMX_COMPAT_32 galvo_class_mex.cpp
galvo_class_mex.cpp
galvo_class_mex.cpp(26) : warning C4244: 'argument' : conversion from 'double' to 'float', possible loss of data
galvo_class_mex.cpp(29) : warning C4244: 'argument' : conversion from 'double' to 'float', possible loss of data
Contents of C:\Users\tomograf\AppData\Local\Temp\mex_awSe0o\mex_tmp.rsp:
C:\Users\tomograf\AppData\Local\Temp\mex_awSe0o\galvo_class_mex.obj
--> link /out:"galvo_class_mex.mexw64" /dll /export:mexFunction /LIBPATH:"C:\Program Files\MATLAB\R2012b\extern\lib\win64\microsoft" libmx.lib libmex.lib libmat.lib /MACHINE:AMD64 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /implib:"C:\Users\tomograf\AppData\Local\Temp\mex_awSe0o\templib.x" /MAP:"galvo_class_mex.mexw64.map" /nologo /incremental:NO @C:\Users\tomograf\AppData\Local\Temp\mex_awSe0o\mex_tmp.rsp
Creating library C:\Users\tomograf\AppData\Local\Temp\mex_awSe0o\templib.x and object C:\Users\tomograf\AppData\Local\Temp\mex_awSe0o\templib.exp
galvo_class_mex.obj : error LNK2019: unresolved external symbol cbErrHandling referenced in function "public: __cdecl AOut::AOut(void)" (??0AOut@@QEAA@XZ)
galvo_class_mex.obj : error LNK2019: unresolved external symbol cbDeclareRevision referenced in function "public: __cdecl AOut::AOut(void)" (??0AOut@@QEAA@XZ)
galvo_class_mex.obj : error LNK2019: unresolved external symbol cbAOut referenced in function "public: void __cdecl AOut::wartosc(double *,double *)" (?wartosc@AOut@@QEAAXPEAN0@Z)
galvo_class_mex.obj : error LNK2019: unresolved external symbol cbFromEngUnits referenced in function "public: void __cdecl AOut::wartosc(double *,double *)" (?wartosc@AOut@@QEAAXPEAN0@Z)
galvo_class_mex.mexw64 : fatal error LNK1120: 4 unresolved externals
C:\PROGRA~1\MATLAB\R2012B\BIN\MEX.PL: Error: Link of 'galvo_class_mex.mexw64' failed.
Error using mex (line 206)
Unable to complete successfully.
I don't know why the middle of the output looks so strange, it looks diffrently in matlab, but maybe copy/paste did it.
Is it the same version of Matlab in both computers? Are both versions 64bits? Did you use the same compiler on both?
Matlabs are the same, both 64bits, but we have different compilers. I have VS 2010, he - VS 2012.
Those error messages are consistent with not having linked against a Measurement Computing cbw64.dll . You may need to add a -L option naming the directory it is in, and using -lcbw64 (lower-case L there)
There is still the same error :(
>> mex -lcbw64 -L"C:\Users\tomograf\Documents\ASielecki_galvo\C___class_interface" galvo_class_mex.cpp
galvo_class_mex.cpp
c:\users\tomograf\documents\asielecki_galvo\c___class_interface\class_handle.hpp(4) : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory
C:\PROGRA~1\MATLAB\R2012B\BIN\MEX.PL: Error: Compile of 'galvo_class_mex.cpp' failed.
Error using mex (line 206) Unable to complete successfully.
Any other ideas how to solve it?
Maria commented to my solution:
This solution works!! Thank you!
The "There is still the same error" response was caused by having omitted the -I parameter that had been described earlier. Both the -I and -L and -l are needed.

Melden Sie sich an, um zu kommentieren.

 Akzeptierte Antwort

I use the solution as Walter Roberson wrote.
I compile a mex file using firstly -lcbw64 (lower case of L) and then location of the cbw64.dll file with -L.
mex -lcbw64 -L"location_of_cbw64.dll" mex_filename

Weitere Antworten (0)

Kategorien

Mehr zu MATLAB Compiler finden Sie in Hilfe-Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by