I'm trying to stream input from a single U3 channel. Ideally I'd like to do this in matlab, and have looked at some of the online resources - looks like compliling c code within matlab (using mex) is going to be the easiest route.
To start with, though, I'm just trying to compile the example U3Stream.c that comes with the exodriver folder and can't even get that far. I get the following error when I try "make" within the folder examples/U3:
Makefile:1: *** missing separator. Stop.
Any suggestions? Thanks.
Just a quick follow-up. Based on some on-line searching, I tried re-typing a tab into the first line of Makefile. That gave me this error:
Makefile:1: *** commands commence before first target. Stop.
Then I tried commenting out the first line entirely. That gave me this error:
couldn't understand kern.osversion `14.3.0'
A bit of online searching suggested this fix (something to do with command line developer tools not part of the default xcode package or something.)
xcode-select --install
Which still gives couldn't understand kern.osversion `14.3.0' but this seems to be only a warning now and allows me to run the make file and creates executables but I'm a bit concerned about having commented out the first line - not entirely sure what it does ("qq#"). Am I good to go or should I worry about that?
Thanks, Matthew
I tried our current U3 examples Makefile and didn't see that error. I believe that error occurs when tab characters are not used for indentation before the $(CC) and rm commands. The Makefiles in our examples do use tabs, so perhaps you opened the Makefile in a text editor that changed these tabs to spaces. Either modify your Makefile to use a tab character for indentation, or download a new copy of the Makefile and run it without modification.
Thanks - I see your Makefile doesn't have the first line mine does ("qq#"), so probably I added that in by accident while viewing it and commenting it out is the right thing to do. So I think on the C side of things I'm ok. Now, just need to figure out how to compile in mex...
I haven't built a mex, but it seems like you need to wirte a gateway function in one of your C/C++ source code files and don't need a Makefile.
http://www.mathworks.com/help/matlab/matlab_external/what-you-need-to-build-mex-files.html
http://www.mathworks.com/help/matlab/ref/mex.html
Thanks I'll have a look at those links. Can I ask a dumb question about the c Makefile? You have: $(LDFLAGS) in your individual function compilation lines, but I don't see that parameter defined anywhere else (I see CFFLAGS defined but seems unused). Am I missing something? Confused how it doesn't crash if undefined - in the lines that are displayed during compilation it looks like it's using the CFLAGS value but unclear how it knows to use CFLAGS in place of LDFLAGS.
I did an online search, but the only makefile examples I could find had CFLAGS and LDFLAGS defined individually. Sorry for the basic questions.
When using make, $(CC) defaults to cc (C compiler). $(CFLAGS) and $(CPPFLAGS) are used implicitly by cc. Undefined variables do not cause an error an will expand to no value/string.