The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: mex function for beginners
Replies: 13   Last Post: Aug 3, 2011 12:52 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Kaustubha Govind

Posts: 52
Registered: 3/9/11
Re: mex function for beginners
Posted: May 10, 2011 9:58 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply


One possibility is that the files you are linking against are somehow meant
for a 32-bit platform, but you are trying to build a 64-bit MEX function.
The reason I say this is because Microsoft Visual Studio on 64-bit machines
is configured by default to create a 32-bit binary (unless you have
explicitly configured it to build a 64-bit binary).

If possible, you could install 32-bit MATLAB on the same 64-bit machine (see
and try again. If that works, then you need to figure out which of the files
are written for 32-bit.

Kaustubha Govind

"Ahmed Hakim" <> wrote in message
> Hello I have problems with using MEX function
> I purchased some C++ files and I want to use them in MATLAB
> these files are:
> SAT_Filter.cpp
> SAT_DE.cpp SAT_Filter.cpp SAT_Kepler.cpp
> SAT_RefSys.cpp SAT_Time.cpp SAT_VecMat.cpp RTOD.cpp
> and their header files:
> SAT_Force.h SAT_DE.h SAT_Filter.h SAT_Kepler.h
> SAT_RefSys.h SAT_Time.h SAT_VecMat.h Sat_const.h
> when using command mex -v SAT_Filter.cpp SAT_DE.cpp SAT_Filter.cpp
> SAT_Kepler.cpp SAT_RefSys.cpp SAT_Time.cpp SAT_VecMat.cpp RTOD.cpp
> I have these errors:
> --> link /out:"SAT_Filter.mexw64" /dll /export:mexFunction
> /LIBPATH:"C:\PROGRA~1\MATLAB\R2009B\extern\lib\win64\microsoft" libmx.lib
> libmex.lib libmat.lib /MACHINE:X64 kernel32.lib user32.lib gdi32.lib
> winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib
> uuid.lib odbc32.lib odbccp32.lib /nologo /incremental:NO
> /implib:"C:\USERS\AHMEDH~1\APPDATA\LOCAL\TEMP\MEX_PY~1\templib.x"
> /MAP:""
> LNK4042: object specified more than once; extras ignored Creating library
> C:\USERS\AHMEDH~1\APPDATA\LOCAL\TEMP\MEX_PY~1\templib.x and object
> C:\USERS\AHMEDH~1\APPDATA\LOCAL\TEMP\MEX_PY~1\templib.exp RTOD.obj : error
> LNK2019: unresolved external symbol "class Vector __cdecl
> AccelHarmonic(class Vector const &,class Matrix const
> &,double,double,class Matrix const &,int,int)"
> (?AccelHarmonic@@YA?AVVector@@AEBV1@AEBVMatrix@@NN1HH@Z) referenced in
> function "class Vector __cdecl Accel(double,class Vector const &,int)"
> (?Accel@@YA?AVVector@@NAEBV1@H@Z) SAT_Filter.mexw64 : fatal error LNK1120:
> 1 unresolved externals
> C:\PROGRA~1\MATLAB\R2009B\BIN\MEX.PL: Error: Link of 'SAT_Filter.mexw64'
> failed.
> ??? Error using ==> mex at 221
> Unable to complete successfully.
> So Can anybody help me?

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.