Prev: Help for ode4 function
Next: interpreter
From: Arun Ashok on 13 Apr 2010 04:51 hi diego, Are u able to sort out this problem?.. I am having the same .. Any inputs would be valuable.. Arun "Diego Rebelo" <diegorocharebelo(a)hotmail.com> wrote in message <hljuem$49e$1(a)fred.mathworks.com>... > I'm trying to compile a .c file using mex command in MatLab. This file contains Matlab Engine functions, such as engOpen. This file also contains calls to the following methods: socket, WSAStartup, htons, gethostname, bind, recvfrom,etc. This program is a UDP server that receives datagrams and based on mensage received it interacts and send mensage to MatLab a matlab Session. To compile it I use the following commands in matlab workspace: optsfile = [matlabroot '\bin\win32\mexopts\lccengmatopts.bat']; > And mex('-f', optsfile, 'SlaveMDL.c'); . > > But when I execute these commands the folllowing erros appears in workspace : c:\docume~1\cea\config~1\temp\mex_m8~1\slavemdl.obj .text: undefined reference to '_WSAStartup@8' > c:\docume~1\cea\config~1\temp\mex_m8~1\slavemdl.obj .text: undefined reference to '_socket(a)12' > c:\docume~1\cea\config~1\temp\mex_m8~1\slavemdl.obj .text: undefined reference to '_WSACleanup@0' > c:\docume~1\cea\config~1\temp\mex_m8~1\slavemdl.obj .text: undefined reference to '_htons@4' > c:\docume~1\cea\config~1\temp\mex_m8~1\slavemdl.obj .text: undefined reference to '_gethostname@8' > c:\docume~1\cea\config~1\temp\mex_m8~1\slavemdl.obj .text: undefined reference to '_gethostbyname@4' > c:\docume~1\cea\config~1\temp\mex_m8~1\slavemdl.obj .text: undefined reference to '_closesocket@4' > c:\docume~1\cea\config~1\temp\mex_m8~1\slavemdl.obj .text: undefined reference to '_bind(a)12' > c:\docume~1\cea\config~1\temp\mex_m8~1\slavemdl.obj .text: undefined reference to '_recvfrom(a)24' > C:\ARQUIV~1\MATLAB\R2009B\BIN\MEX.PL: Error: Link of 'SlaveMDL.exe' failed. > > My .C file already includes all .h files such as winsock.h, engine.h,etc. My .c file header is like this: > > #include <stdio.h> > #include <windows.h> > #include <stdlib.h> > #include <string.h> > #include <winsock2.h> > #include <time.h> > #include "engine.h" > > Anyone can help me ???
From: Steve Amphlett on 13 Apr 2010 07:03 "Arun Ashok" <arunashok(a)gmail.com> wrote in message <hq1b9p$7m6$1(a)fred.mathworks.com>... > hi diego, > > Are u able to sort out this problem?.. I am having the same .. Any inputs would be valuable.. > > Arun > > > > > "Diego Rebelo" <diegorocharebelo(a)hotmail.com> wrote in message <hljuem$49e$1(a)fred.mathworks.com>... > > I'm trying to compile a .c file using mex command in MatLab. This file contains Matlab Engine functions, such as engOpen. This file also contains calls to the following methods: socket, WSAStartup, htons, gethostname, bind, recvfrom,etc. This program is a UDP server that receives datagrams and based on mensage received it interacts and send mensage to MatLab a matlab Session. To compile it I use the following commands in matlab workspace: optsfile = [matlabroot '\bin\win32\mexopts\lccengmatopts.bat']; > > And mex('-f', optsfile, 'SlaveMDL.c'); . > > > > But when I execute these commands the folllowing erros appears in workspace : c:\docume~1\cea\config~1\temp\mex_m8~1\slavemdl.obj .text: undefined reference to '_WSAStartup@8' > > c:\docume~1\cea\config~1\temp\mex_m8~1\slavemdl.obj .text: undefined reference to '_socket(a)12' > > c:\docume~1\cea\config~1\temp\mex_m8~1\slavemdl.obj .text: undefined reference to '_WSACleanup@0' > > c:\docume~1\cea\config~1\temp\mex_m8~1\slavemdl.obj .text: undefined reference to '_htons@4' > > c:\docume~1\cea\config~1\temp\mex_m8~1\slavemdl.obj .text: undefined reference to '_gethostname@8' > > c:\docume~1\cea\config~1\temp\mex_m8~1\slavemdl.obj .text: undefined reference to '_gethostbyname@4' > > c:\docume~1\cea\config~1\temp\mex_m8~1\slavemdl.obj .text: undefined reference to '_closesocket@4' > > c:\docume~1\cea\config~1\temp\mex_m8~1\slavemdl.obj .text: undefined reference to '_bind(a)12' > > c:\docume~1\cea\config~1\temp\mex_m8~1\slavemdl.obj .text: undefined reference to '_recvfrom(a)24' > > C:\ARQUIV~1\MATLAB\R2009B\BIN\MEX.PL: Error: Link of 'SlaveMDL.exe' failed. > > > > My .C file already includes all .h files such as winsock.h, engine.h,etc. My .c file header is like this: > > > > #include <stdio.h> > > #include <windows.h> > > #include <stdlib.h> > > #include <string.h> > > #include <winsock2.h> > > #include <time.h> > > #include "engine.h" > > > > Anyone can help me ??? Have you linked with ws2_32.lib? It is the actual library that contains the functions prototyped in winsock2.h.
From: Arun Ashok on 13 Apr 2010 08:12 Hi. I got it.. It didnt work with ws2_32.lib but instead with wsock32.lib.. Arun Steve Amphlett" <Firstname.Lastname(a)Where-I-Work.com> wrote in message <hq1j1b$914$1(a)fred.mathworks.com>... > "Arun Ashok" <arunashok(a)gmail.com> wrote in message <hq1b9p$7m6$1(a)fred.mathworks.com>... > > hi diego, > > > > Are u able to sort out this problem?.. I am having the same .. Any inputs would be valuable.. > > > > Arun > > > > > > > > > > "Diego Rebelo" <diegorocharebelo(a)hotmail.com> wrote in message <hljuem$49e$1(a)fred.mathworks.com>... > > > I'm trying to compile a .c file using mex command in MatLab. This file contains Matlab Engine functions, such as engOpen. This file also contains calls to the following methods: socket, WSAStartup, htons, gethostname, bind, recvfrom,etc. This program is a UDP server that receives datagrams and based on mensage received it interacts and send mensage to MatLab a matlab Session. To compile it I use the following commands in matlab workspace: optsfile = [matlabroot '\bin\win32\mexopts\lccengmatopts.bat']; > > > And mex('-f', optsfile, 'SlaveMDL.c'); . > > > > > > But when I execute these commands the folllowing erros appears in workspace : c:\docume~1\cea\config~1\temp\mex_m8~1\slavemdl.obj .text: undefined reference to '_WSAStartup@8' > > > c:\docume~1\cea\config~1\temp\mex_m8~1\slavemdl.obj .text: undefined reference to '_socket(a)12' > > > c:\docume~1\cea\config~1\temp\mex_m8~1\slavemdl.obj .text: undefined reference to '_WSACleanup@0' > > > c:\docume~1\cea\config~1\temp\mex_m8~1\slavemdl.obj .text: undefined reference to '_htons@4' > > > c:\docume~1\cea\config~1\temp\mex_m8~1\slavemdl.obj .text: undefined reference to '_gethostname@8' > > > c:\docume~1\cea\config~1\temp\mex_m8~1\slavemdl.obj .text: undefined reference to '_gethostbyname@4' > > > c:\docume~1\cea\config~1\temp\mex_m8~1\slavemdl.obj .text: undefined reference to '_closesocket@4' > > > c:\docume~1\cea\config~1\temp\mex_m8~1\slavemdl.obj .text: undefined reference to '_bind(a)12' > > > c:\docume~1\cea\config~1\temp\mex_m8~1\slavemdl.obj .text: undefined reference to '_recvfrom(a)24' > > > C:\ARQUIV~1\MATLAB\R2009B\BIN\MEX.PL: Error: Link of 'SlaveMDL.exe' failed. > > > > > > My .C file already includes all .h files such as winsock.h, engine.h,etc. My .c file header is like this: > > > > > > #include <stdio.h> > > > #include <windows.h> > > > #include <stdlib.h> > > > #include <string.h> > > > #include <winsock2.h> > > > #include <time.h> > > > #include "engine.h" > > > > > > Anyone can help me ??? > > Have you linked with ws2_32.lib? It is the actual library that contains the functions prototyped in winsock2.h.
|
Pages: 1 Prev: Help for ode4 function Next: interpreter |