<div dir="ltr"><div><br></div><div>Hi,</div><div><br></div>We are using 128 channel Biosemi Active Two device. We are working on a BCI project, where we want to acquire data in real-time from Biosemi. <br><br>We are trying to incorporate fieldtrip real time buffer for our real time data acquisition. For the implementation we are following the steps provided on the fieldtrip website. We are getting certain errors during this implementation for which we request your guidance. <span style="color:rgb(68,68,68)"><br>Windows:</span><div><font color="#444444"><br></font><div><span style="color:rgb(68,68,68)">We are using Windows 7, 64 bit system. </span></div><div><span style="color:rgb(68,68,68)">Installed Softwares:</span></div><div><span style="color:rgb(68,68,68)">Microsoft Visual C++ 2005, 2008, 2010, 2012 and 2013</span></div><div><span style="color:rgb(68,68,68)">Microsoft Windows SDK 7.1</span></div><div><span style="color:rgb(68,68,68)">MinGW compiler and MSYS</span></div><div>Cygwin</div><div><br></div><div>1. The matlab inside part of buffer compilation, i.e creation of mex file on matlab using 'compile' in src/buffer/matlab directory, gave the following error. <span style="color:rgb(68,68,68)"><br></span></div><div><span style="color:rgb(68,68,68)">We tried it using Visual Studio and minGW compilers.</span></div><div><span style="color:rgb(68,68,68)"><br></span></div><div><div><font color="#444444"><i>>> mex -setup </i></font></div><div><font color="#444444"><i>MEX configured to use 'Microsoft Windows SDK 7.1 (C)' for C language compilation.</i></font></div><div><font color="#444444"><i>Warning: The MATLAB C and Fortran API has changed to support MATLAB</i></font></div><div><font color="#444444"><i><span class="gmail-Apple-tab-span" style="white-space:pre">   </span> variables with more than 2^32-1 elements. In the near future</i></font></div><div><font color="#444444"><i><span class="gmail-Apple-tab-span" style="white-space:pre">   </span> you will be required to update your code to utilize the</i></font></div><div><font color="#444444"><i><span class="gmail-Apple-tab-span" style="white-space:pre">        </span> new API. You can find more information about this at:</i></font></div><div><font color="#444444"><i><span class="gmail-Apple-tab-span" style="white-space:pre">  </span> <a href="http://www.mathworks.com/help/matlab/matlab_external/upgrading-mex-files-to-use-64-bit-api.html">http://www.mathworks.com/help/matlab/matlab_external/upgrading-mex-files-to-use-64-bit-api.html</a>.</i></font></div><div><font color="#444444"><i><br></i></font></div><div><font color="#444444"><i>To choose a different language, select one from the following:</i></font></div><div><font color="#444444"><i> mex -setup C++ </i></font></div><div><font color="#444444"><i> mex -setup FORTRAN</i></font></div><div><font color="#444444"><i><br></i></font></div><div><font color="#444444"><i>>> compile('vc')</i></font></div><div><font color="#444444"><i>Compiling library functions in util.c ...</i></font></div><div><font color="#444444"><i>Building with 'Microsoft Windows SDK 7.1 (C)'.</i></font></div><div><font color="#444444"><i>Error using mex</i></font></div><div><font color="#444444"><i>util.c</i></font></div><div><font color="#444444"><i>C:\Program</i></font></div><div><font color="#444444"><i>Files\MATLAB\R2016a\toolbox\fieldtrip-20170102\fieldtrip-20170102\realtime\src\buffer\src\util.c(13) : fatal</i></font></div><div><font color="#444444"><i>error C1083: Cannot open include file: 'sys/time.h': No such file or directory</i></font></div><div><br></div><div><font color="#444444"><i>Error in compile (line 156)</i></font></div><div><font color="#444444"><i>  eval(cmd);</i></font></div><div><br></div><div><br></div><div><font color="#444444"><i>>> compile('mingw','C:/MinGW/lib')</i></font></div><div><font color="#444444"><i>Compiling library functions in util.c ...</i></font></div><div><font color="#444444"><i>Building with 'Microsoft Windows SDK 7.1 (C)'.</i></font></div><div><font color="#444444"><i>Error using mex</i></font></div><div><font color="#444444"><i>util.c</i></font></div><div><font color="#444444"><i>C:\Program</i></font></div><div><font color="#444444"><i>Files\MATLAB\R2016a\toolbox\fieldtrip-20170102\fieldtrip-20170102\realtime\src\buffer\src\util.c(13) : fatal</i></font></div><div><font color="#444444"><i>error C1083: Cannot open include file: 'sys/time.h': No such file or directory</i></font></div><div><br></div><div><font color="#444444"><i>Error in compile (line 156)</i></font></div><div><font color="#444444"><i>  eval(cmd);</i></font></div></div><div><font color="#444444"><i><br></i></font></div><div><font color="#000000"><br></font></div><div><font color="#000000">2. The matlab outside part compilation of buffer in src/buffer/src directory was attempted using make in cygwin terminal. We got the following error:</font></div><div><font color="#444444"><i><br></i></font></div><div><div style="color:rgb(68,68,68);font-style:italic">EEG-EGI@EEG-EGI-PC /cygdrive/c/Program Files/MATLAB/R2016a/toolbox/fieldtrip-201                     70102/fieldtrip-20170102/realtime/src/buffer/src</div><div style="color:rgb(68,68,68);font-style:italic">$ make</div><div style="color:rgb(68,68,68);font-style:italic">gcc -I. -Wunused -Wall -pedantic -O0 -fPIC -g   -c -o tcpserver.o tcpserver.c</div><div style="color:rgb(68,68,68);font-style:italic">tcpserver.c:1:0: warning: -fPIC ignored for target (all code is position indepen                     dent)</div><div style="color:rgb(68,68,68);font-style:italic"> /*</div><div style="color:rgb(68,68,68);font-style:italic"> ^</div><div style="color:rgb(68,68,68);font-style:italic">tcpserver.c: In function ‘cleanup_tcpserver’:</div><div style="color:rgb(68,68,68);font-style:italic">tcpserver.c:31:5: warning: implicit declaration of function ‘closesocket’ [-Wimp                     licit-function-declaration]</div><div style="color:rgb(68,68,68);font-style:italic">     closesocket(threadlocal->fd);</div><div style="color:rgb(68,68,68);font-style:italic">     ^</div><div style="color:rgb(68,68,68);font-style:italic">tcpserver.c: In function ‘tcpserver’:</div><div style="color:rgb(68,68,68);font-style:italic">tcpserver.c:51:22: error: storage size of ‘sa’ isn’t known</div><div style="color:rgb(68,68,68);font-style:italic">   struct sockaddr_in sa;</div><div style="color:rgb(68,68,68);font-style:italic">                      ^</div><div style="color:rgb(68,68,68);font-style:italic">tcpserver.c:102:12: warning: implicit declaration of function ‘socket’ [-Wimplic                     it-function-declaration]</div><div style="color:rgb(68,68,68);font-style:italic">   if ((s = socket(PF_INET, SOCK_STREAM, 0)) < 0) {</div><div style="color:rgb(68,68,68);font-style:italic">            ^</div><div style="color:rgb(68,68,68);font-style:italic">tcpserver.c:102:19: error: ‘PF_INET’ undeclared (first use in this function)</div><div style="color:rgb(68,68,68);font-style:italic">   if ((s = socket(PF_INET, SOCK_STREAM, 0)) < 0) {</div><div style="color:rgb(68,68,68);font-style:italic">                   ^</div><div style="color:rgb(68,68,68);font-style:italic">tcpserver.c:102:19: note: each undeclared identifier is reported only once for e                     ach function it appears in</div><div style="color:rgb(68,68,68);font-style:italic">tcpserver.c:102:28: error: ‘SOCK_STREAM’ undeclared (first use in this function)</div><div style="color:rgb(68,68,68);font-style:italic">   if ((s = socket(PF_INET, SOCK_STREAM, 0)) < 0) {</div><div style="color:rgb(68,68,68);font-style:italic">                            ^</div><div style="color:rgb(68,68,68);font-style:italic">tcpserver.c:136:7: warning: implicit declaration of function ‘setsockopt’ [-Wimp                     licit-function-declaration]</div><div style="color:rgb(68,68,68);font-style:italic">   if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (const char*)&optval, sizeof(optv                     al)) < 0) {</div><div style="color:rgb(68,68,68);font-style:italic">       ^</div><div style="color:rgb(68,68,68);font-style:italic">tcpserver.c:136:21: error: ‘SOL_SOCKET’ undeclared (first use in this function)</div><div style="color:rgb(68,68,68);font-style:italic">   if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (const char*)&optval, sizeof(optv                     al)) < 0) {</div><div style="color:rgb(68,68,68);font-style:italic">                     ^</div><div style="color:rgb(68,68,68);font-style:italic">tcpserver.c:136:33: error: ‘SO_REUSEADDR’ undeclared (first use in this function                     )</div><div style="color:rgb(68,68,68);font-style:italic">   if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (const char*)&optval, sizeof(optv                     al)) < 0) {</div><div style="color:rgb(68,68,68);font-style:italic">                                 ^</div><div style="color:rgb(68,68,68);font-style:italic">tcpserver.c:142:19: error: ‘AF_INET’ undeclared (first use in this function)</div><div style="color:rgb(68,68,68);font-style:italic">   sa.sin_family = AF_INET;</div><div style="color:rgb(68,68,68);font-style:italic">                   ^</div><div style="color:rgb(68,68,68);font-style:italic">tcpserver.c:143:19: warning: implicit declaration of function ‘htons’ [-Wimplici                     t-function-declaration]</div><div style="color:rgb(68,68,68);font-style:italic">   sa.sin_port   = htons(host->port);</div><div style="color:rgb(68,68,68);font-style:italic">                   ^</div><div style="color:rgb(68,68,68);font-style:italic">tcpserver.c:145:7: error: ‘INADDR_ANY’ undeclared (first use in this function)</div><div style="color:rgb(68,68,68);font-style:italic">   if (INADDR_ANY)</div><div style="color:rgb(68,68,68);font-style:italic">       ^</div><div style="color:rgb(68,68,68);font-style:italic">tcpserver.c:146:26: warning: implicit declaration of function ‘htonl’ [-Wimplici                     t-function-declaration]</div><div style="color:rgb(68,68,68);font-style:italic">     sa.sin_addr.s_addr = htonl(INADDR_ANY);</div><div style="color:rgb(68,68,68);font-style:italic">                          ^</div><div style="color:rgb(68,68,68);font-style:italic">tcpserver.c:148:7: warning: implicit declaration of function ‘bind’ [-Wimplicit-                     function-declaration]</div><div style="color:rgb(68,68,68);font-style:italic">   if (bind(s, (struct sockaddr *)&sa, sizeof sa) < 0) {</div><div style="color:rgb(68,68,68);font-style:italic">       ^</div><div style="color:rgb(68,68,68);font-style:italic">tcpserver.c:153:7: warning: implicit declaration of function ‘listen’ [-Wimplici                     t-function-declaration]</div><div style="color:rgb(68,68,68);font-style:italic">   if (listen(s, BACKLOG)<0) {</div><div style="color:rgb(68,68,68);font-style:italic">       ^</div><div style="color:rgb(68,68,68);font-style:italic">tcpserver.c:168:9: warning: implicit declaration of function ‘accept’ [-Wimplici                     t-function-declaration]</div><div style="color:rgb(68,68,68);font-style:italic">     c = accept(s, (struct sockaddr *)&sa, &b);</div><div style="color:rgb(68,68,68);font-style:italic">         ^</div><div style="color:rgb(68,68,68);font-style:italic">tcpserver.c:186:9: warning: implicit declaration of function ‘usleep’ [-Wimplici                     t-function-declaration]</div><div style="color:rgb(68,68,68);font-style:italic">         usleep(ACCEPTSLEEP);</div><div style="color:rgb(68,68,68);font-style:italic">         ^</div><div style="color:rgb(68,68,68);font-style:italic">tcpserver.c:202:23: error: storage size of ‘lg’ isn’t known</div><div style="color:rgb(68,68,68);font-style:italic">         struct linger lg;</div><div style="color:rgb(68,68,68);font-style:italic">                       ^</div><div style="color:rgb(68,68,68);font-style:italic">tcpserver.c:207:35: error: ‘SO_LINGER’ undeclared (first use in this function)</div><div style="color:rgb(68,68,68);font-style:italic">         setsockopt(s, SOL_SOCKET, SO_LINGER, (char *) &lg, sizeof(lg));</div><div style="color:rgb(68,68,68);font-style:italic">                                   ^</div><div style="color:rgb(68,68,68);font-style:italic">tcpserver.c:202:23: warning: unused variable ‘lg’ [-Wunused-variable]</div><div style="color:rgb(68,68,68);font-style:italic">         struct linger lg;</div><div style="color:rgb(68,68,68);font-style:italic">                       ^</div><div style="color:rgb(68,68,68);font-style:italic">tcpserver.c:213:37: error: ‘SO_RCVBUF’ undeclared (first use in this function)</div><div style="color:rgb(68,68,68);font-style:italic">       if (setsockopt(c, SOL_SOCKET, SO_RCVBUF, (const char*)&optval, sizeof(opt                     val)) < 0) {</div><div style="color:rgb(68,68,68);font-style:italic">                                     ^</div><div style="color:rgb(68,68,68);font-style:italic">tcpserver.c:220:37: error: ‘SO_SNDBUF’ undeclared (first use in this function)</div><div style="color:rgb(68,68,68);font-style:italic">       if (setsockopt(c, SOL_SOCKET, SO_SNDBUF, (const char*)&optval, sizeof(opt                     val)) < 0) {</div><div style="color:rgb(68,68,68);font-style:italic">                                     ^</div><div style="color:rgb(68,68,68);font-style:italic">tcpserver.c:249:50: warning: cast to pointer from integer of different size [-Wi                     nt-to-pointer-cast]</div><div style="color:rgb(68,68,68);font-style:italic">       rc = pthread_create(&tid, NULL, tcpsocket, (void *)c);</div><div style="color:rgb(68,68,68);font-style:italic">                                                  ^</div><div style="color:rgb(68,68,68);font-style:italic">tcpserver.c:267:10: warning: zero-length gnu_printf format string [-Wformat-zero                     -length]</div><div style="color:rgb(68,68,68);font-style:italic">   printf("");</div><div style="color:rgb(68,68,68);font-style:italic">          ^</div><div style="color:rgb(68,68,68);font-style:italic">tcpserver.c:267:10: warning: zero-length gnu_printf format string [-Wformat-zero                     -length]</div><div style="color:rgb(68,68,68);font-style:italic">tcpserver.c:56:23: warning: unused variable ‘oldcanceltype’ [-Wunused-variable]</div><div style="color:rgb(68,68,68);font-style:italic">   int oldcancelstate, oldcanceltype;</div><div style="color:rgb(68,68,68);font-style:italic">                       ^</div><div style="color:rgb(68,68,68);font-style:italic">tcpserver.c:56:7: warning: unused variable ‘oldcancelstate’ [-Wunused-variable]</div><div style="color:rgb(68,68,68);font-style:italic">   int oldcancelstate, oldcanceltype;</div><div style="color:rgb(68,68,68);font-style:italic">       ^</div><div style="color:rgb(68,68,68);font-style:italic">tcpserver.c:51:22: warning: unused variable ‘sa’ [-Wunused-variable]</div><div style="color:rgb(68,68,68);font-style:italic">   struct sockaddr_in sa;</div><div style="color:rgb(68,68,68);font-style:italic">                      ^</div><div style="color:rgb(68,68,68);font-style:italic">make: *** [<builtin>: tcpserver.o] Error 1</div><div><font color="#000000"><br></font></div><div><font color="#000000">Please help us debug the same.</font></div></div><div><font color="#000000"><br></font></div><div><font color="#000000">Thank you.</font></div><div><font color="#000000">Suhas G</font></div>
</div></div>