From: Titas Bera on 4 Feb 2010 01:10 Hi to all, I was trying to build a binary mex file Box.c which contain a very simple OpenGl code. Here is my code look like ****************************************************** #include "mex.h" #include "windows.h" #include "glut.h" void Box(void) { glColor3f(1.0,0.5,1.0); glBegin(GL_POLYGON); glVertex3f(0.25,0.25,0.0); glVertex3f(0.75,0.25,0.0); glVertex3f(0.75,0.75,0.0); glVertex3f(0.25,0.75,0.0); glEnd(); glFlush(); } void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) { Box(); } ***************************************************** when I try to build the mex file from MATLAB command prompt using "mex Box.c" here is what I get ****************************************************** Writing library for Box.mexw32 c:\docume~1\titasb~1\locals~1\temp\mex_27cf9fb5-2da9-43fe-58a1-52699e67856b\box.obj .text: undefined reference to '___glutInitWithExit(a)12' c:\docume~1\titasb~1\locals~1\temp\mex_27cf9fb5-2da9-43fe-58a1-52699e67856b\box.obj .text: undefined reference to '___glutCreateWindowWithExit@8' c:\docume~1\titasb~1\locals~1\temp\mex_27cf9fb5-2da9-43fe-58a1-52699e67856b\box.obj .text: undefined reference to '___glutCreateMenuWithExit@8' c:\docume~1\titasb~1\locals~1\temp\mex_27cf9fb5-2da9-43fe-58a1-52699e67856b\box.obj .text: undefined reference to '_glColor3f(a)12' c:\docume~1\titasb~1\locals~1\temp\mex_27cf9fb5-2da9-43fe-58a1-52699e67856b\box.obj .text: undefined reference to '_glBegin@4' c:\docume~1\titasb~1\locals~1\temp\mex_27cf9fb5-2da9-43fe-58a1-52699e67856b\box.obj .text: undefined reference to '_glVertex3f(a)12' c:\docume~1\titasb~1\locals~1\temp\mex_27cf9fb5-2da9-43fe-58a1-52699e67856b\box.obj .text: undefined reference to '_glEnd@0' c:\docume~1\titasb~1\locals~1\temp\mex_27cf9fb5-2da9-43fe-58a1-52699e67856b\box.obj .text: undefined reference to '_glFlush@0' C:\PROGRA~1\MATLAB\R2007B\BIN\MEX.PL: Error: Link of 'Box.mexw32' failed. **************************************************************** Following some post in MATLAB user group I tried the following command mex -v -lgl -lglut -lGLU Box.c. But now I get the following errors **************************************************************** >> mex -v -lgl -lglut -lGLU Box.c This is mex, Copyright 1984-2006 The MathWorks, Inc. Warning: gl specified with -l option not found on -L path Warning: glut specified with -l option not found on -L path Warning: GLU specified with -l option not found on -L path -> Default options filename found in C:\Documents and Settings\Titas Bera\Application Data\MathWorks\MATLAB\R2007b ---------------------------------------------------------------- -> Options file = C:\Documents and Settings\Titas Bera\Application Data\MathWorks\MATLAB\R2007b\mexopts.bat MATLAB = C:\PROGRA~1\MATLAB\R2007b -> COMPILER = lcc -> Compiler flags: COMPFLAGS = -c -Zp8 -I"C:\PROGRA~1\MATLAB\R2007b\sys\lcc\include" -DMATLAB_MEX_FILE -noregistrylookup OPTIMFLAGS = -DNDEBUG DEBUGFLAGS = -g4 arguments = Name switch = -Fo -> Pre-linking commands = -> LINKER = lcclnk -> Link directives: LINKFLAGS = -tmpdir "." -dll "C:\PROGRA~1\MATLAB\R2007b\extern\lib\win32\lcc\mexFunction.def" -L"C:\PROGRA~1\MATLAB\R2007b\sys\lcc\lib" -libpath "C:\PROGRA~1\MATLAB\R2007b\extern\lib\win32\lcc" C:\DOCUME~1\TITASB~1\LOCALS~1\Temp\mex_88BAD537-647D-4EFC-30A7-B03A2B4D6428\templib2.obj LINKDEBUGFLAGS = LINKFLAGSPOST = libmx.lib libmex.lib libmat.lib Name directive = -o "Box.mexw32" File link directive = Lib. link directive = Rsp file indicator = @ -> Resource Compiler = lrc -I"C:\PROGRA~1\MATLAB\R2007b\sys\lcc\include" -noregistrylookup -fo"mexversion.res" -> Resource Linker = ---------------------------------------------------------------- --> "lcc -c -Zp8 -I"C:\PROGRA~1\MATLAB\R2007b\sys\lcc\include" -DMATLAB_MEX_FILE -noregistrylookup -FoC:\DOCUME~1\TITASB~1\LOCALS~1\Temp\mex_88BAD537-647D-4EFC-30A7-B03A2B4D6428\Box.obj -IC:\PROGRA~1\MATLAB\R2007b\extern\include -IC:\PROGRA~1\MATLAB\R2007b\simulink\include -DNDEBUG -DMX_COMPAT_32 Box.c" lcc preprocessor warning: Box.c:17 No newline at end of file Warning C:\PROGRA~1\MATLAB\R2007b\sys\lcc\include\glut.h: 549 static `int function(pointer to void function(int)) glutCreateMenu_ATEXIT_HACK' is not referenced Warning C:\PROGRA~1\MATLAB\R2007b\sys\lcc\include\glut.h: 503 static `int function(pointer to const char) glutCreateWindow_ATEXIT_HACK' is not referenced Warning C:\PROGRA~1\MATLAB\R2007b\sys\lcc\include\glut.h: 486 static `void function(pointer to int,pointer to pointer to char) glutInit_ATEXIT_HACK' is not referenced 0 errors, 4 warnings --> "lcc -c -Zp8 -I"C:\PROGRA~1\MATLAB\R2007b\sys\lcc\include" -DMATLAB_MEX_FILE -noregistrylookup "C:\PROGRA~1\MATLAB\R2007b\sys\lcc\mex\lccstub.c" -FoC:\DOCUME~1\TITASB~1\LOCALS~1\Temp\mex_88BAD537-647D-4EFC-30A7-B03A2B4D6428\templib2.obj" Contents of C:\DOCUME~1\TITASB~1\LOCALS~1\Temp\mex_88BAD537-647D-4EFC-30A7-B03A2B4D6428\mex_tmp.rsp: C:\DOCUME~1\TITASB~1\LOCALS~1\Temp\mex_88BAD537-647D-4EFC-30A7-B03A2B4D6428\Box.obj --> "lcclnk -o "Box.mexw32" -tmpdir "." -dll "C:\PROGRA~1\MATLAB\R2007b\extern\lib\win32\lcc\mexFunction.def" -L"C:\PROGRA~1\MATLAB\R2007b\sys\lcc\lib" -libpath "C:\PROGRA~1\MATLAB\R2007b\extern\lib\win32\lcc" C:\DOCUME~1\TITASB~1\LOCALS~1\Temp\mex_88BAD537-647D-4EFC-30A7-B03A2B4D6428\templib2.obj -s @C:\DOCUME~1\TITASB~1\LOCALS~1\Temp\mex_88BAD537-647D-4EFC-30A7-B03A2B4D6428\mex_tmp.rsp libmx.lib libmex.lib libmat.lib" Writing library for Box.mexw32 c:\docume~1\titasb~1\locals~1\temp\mex_88bad537-647d-4efc-30a7-b03a2b4d6428\box.obj .text: undefined reference to '___glutInitWithExit(a)12' c:\docume~1\titasb~1\locals~1\temp\mex_88bad537-647d-4efc-30a7-b03a2b4d6428\box.obj .text: undefined reference to '___glutCreateWindowWithExit@8' c:\docume~1\titasb~1\locals~1\temp\mex_88bad537-647d-4efc-30a7-b03a2b4d6428\box.obj .text: undefined reference to '___glutCreateMenuWithExit@8' c:\docume~1\titasb~1\locals~1\temp\mex_88bad537-647d-4efc-30a7-b03a2b4d6428\box.obj .text: undefined reference to '_mxglColor3f' c:\docume~1\titasb~1\locals~1\temp\mex_88bad537-647d-4efc-30a7-b03a2b4d6428\box.obj .text: undefined reference to '_glBegin@4' c:\docume~1\titasb~1\locals~1\temp\mex_88bad537-647d-4efc-30a7-b03a2b4d6428\box.obj .text: undefined reference to '_glVertex3f(a)12' c:\docume~1\titasb~1\locals~1\temp\mex_88bad537-647d-4efc-30a7-b03a2b4d6428\box.obj .text: undefined reference to '_glEnd@0' c:\docume~1\titasb~1\locals~1\temp\mex_88bad537-647d-4efc-30a7-b03a2b4d6428\box.obj .text: undefined reference to '_glFlush@0' C:\PROGRA~1\MATLAB\R2007B\BIN\MEX.PL: Error: Link of 'Box.mexw32' failed. ??? Error using ==> mex at 208 Unable to complete successfully. ********************************************************************* What is that I am missing ? Is that there is something worng in source code or I have to include some library files in some directories. I am very novice in this field. Please help. Thanks in advance Regards Titas
From: Rune Allnor on 4 Feb 2010 04:08 On 4 Feb, 07:10, "Titas Bera" <titasb...(a)aero.iisc.ernet.in> wrote: > Hi to all, > I was trying to build a binary mex file Box.c which contain a very simple OpenGl code. Here is my code look like .... > What is that I am missing ? Is that there is something worng in source code or I have to include some library files in some directories. I am very novice in this field. What makes you think it is easy, convenient or even possible to use MEX files with OpenGL in general and Blut in particular, under matlab? Make an executive decision. *Either* code OpengGL *or* code matlab. Rune
From: Jan Simon on 4 Feb 2010 04:39 Dear Titas! > mex -v -lgl -lglut -lGLU Box.c > But now I get the following errors > Warning: gl specified with -l option not found on -L path > Warning: glut specified with -l option not found on -L path > Warning: GLU specified with -l option not found on -L path These warning mean, that the wanted files are not found in the path specified for libraries. So locate the libs and add the corresponding paths in the MEX command or define the libs with absolute paths. There may be more serious difficulties in calling GLUT function in a Mex file, but I wish you good luck and please tell us, if you have success! Jan
|
Pages: 1 Prev: fuzzy logic rules Next: Help Needed Using Vrsynk in External Mode |