lcc preprocessor error with angle brackets inclusion of files
Show older comments
Hi,
I am trying to compile C code in MATLAB using LCC.
I have the C code with files included using angle brackets such as
#include < x.h >
The pre-processor is throwing errors (in lines where ever this is the case) thereby saying
Error using ==> mex at 206 Unable to complete successfully.
Could you help on how to resolve this..?
Thanks, Papi R.
7 Comments
Walter Roberson
on 11 Nov 2012
What error message is given? And does the error go away if you change the angle brackets to double-quotes ?
Papi Reddy D
on 11 Nov 2012
Walter Roberson
on 11 Nov 2012
Your file x.h is in your current directory rather than being in a "system" directory or otherwise along the -I include paths.
Papi Reddy D
on 11 Nov 2012
Walter Roberson
on 11 Nov 2012
The angle-bracket notation means do not look in the current directory, only look along the include path, so lcc is processing the files correctly.
Papi Reddy D
on 11 Nov 2012
Walter Roberson
on 11 Nov 2012
You could try adding -I. (dash capital-eye period) to the compiler flags. You might need a space after the -I
When something like this happens it usually indicates that the source code was copied into a directory that was only intended to hold include files.
Answers (1)
As Walter has explained already, using < and > means, that the file is searched in standard list of system directories. See http://gcc.gnu.org/onlinedocs/cpp/Include-Syntax.html.
[EDITED] I do not see a reason to run #include outside the specifications: < and > for system headers, double quotes for user-defined headers. If #include x.h works on the computer of your colleagues, they have added the folders of user-defined headers to the system path. Besides confusing the system, this methods confuse you also, because your system is still clean. Do not follow their example.
Categories
Find more on MATLAB Compiler in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!