I didn't realize earlier that you were working with the source, I thought you were just trying to include a precompiled object...
On Thu, April 5, 2007 10:46 pm, Mat Kotowsky said: > Hi Tony, > > That's something I didn't try. Though it's probably not the most > graceful solution, I got impatient and ended up just consolidating all of > the C code I wanted to use into one big .c file so that I never had to use > any header files with just the function prototypes listed. I have put the C code into .h files before, in nesC, with no problems. > When I #included > the .c file at the beginning of the *M.nc file, I got the same error - parse > error just before the first line of code. It then occurred to me to move > the #include to the beginning of the implementation section of the module. With the code in a header file, you can just use the 'includes' nesC keyword, at the usual spot and it will work, instead of using preprocessor commands, even with C functions in there. > That worked. It's quite possible that it could have worked the original way > had I included the *.h file at the beginning of the implementation before I > jammed everything into one file. Speaking of beginnings and ends, compilers seem to behave better when you leave just a bit of padding or comment at the start of the file, and some newlines at the end. That has caused me parse errors. It forces those good coding practices, I guess. > Either way, your comments were invaluable. > > Thanks! > -Mat > >> -----Original Message----- >> From: Tony Mancill [mailto:[EMAIL PROTECTED] >> Sent: Thursday, April 05, 2007 6:25 PM >> To: Mat Kotowsky >> Cc: [EMAIL PROTECTED] >> Subject: Re: [Tinyos-help] can I write to a file using nesC >> >> Hi Mat, >> >> if foo is in an external library, maybe you need to declare >> it as an extern so the compiler knows that the linker will >> fix up the reference later? >> >> tony >> >> Mat Kotowsky wrote: >> > Steve, >> > >> > In the message below, you indicated that you can make >> calls to C >> > functions from within nesC code. I'm attempting to do so >> by following >> > your instructions, but the nesC compiler exits with a parse error >> > before a line that looks like >> > >> > void foo(char bar); >> > >> > which is the prototype of the C function that I want to >> call as it is >> > declared in the header file. Can you give me any advice as >> to how to >> > what might be causing this error? >> > >> > Thanks, >> > -Mat -- The difference between the right word and the almost right word is really a large matter- it's the difference between a lightning bug and the lightning. -Twain _______________________________________________ Tinyos-help mailing list [email protected] https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
