We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
#include <reg51.h> //#include "sample delay.h" void MSDelay(unsigned int); void main(void) { while (1) //repeat forever { P1=0x55; MSDelay(250); P1=0xAA; MSDelay(250); } }
#include "sample delay.h" void MSDelay(unsigned int itime) { unsigned int i,j; for (i=0;i<itime;i++) for (j=0;j<1275;j++); }
while do build it displays a warning message in the build window as below sample delay.c(1): warning C318: can't open file 'sample delay.h' please help me in finding out the causes for this warning.
Several possible.
1) You don't have any file with that name. 2) You get into troubles because the file name contains a space. 3) You do have such a file, but not in a path that the compiler is configured to scan for include files. 4) You do have such a file but do not have the required access rights to open it. ...
But the big question here is why you ask for help without informing us what steps you have taken yourself to figure out why the compiler can't locate that file. It isn't like the message is unclear.
By the way - think twice about using spaces in source file names. It tends to produce lots of grief since not all build environments will properly use break characters or quotes when executing command-line tools. And space is used as parameter separator...
http://www.keil.com/forum/58988
1) You don't have any file with that name. 2) You get into troubles because the file name contains a space. 3) You do have such a file, but not in a path that the compiler is configured to scan for include files. 4) You do have such a file but do not have the required access rights to open it.
thanks for your reply the program works well in simulation,it generates expected output.but every time while compiling and building it shows warning message
compiling sample4.c... compiling msdelay.c... msdelay.c(1): warning C318: can't open file 'msdelay.h' linking... Program Size: data=9.0 xdata=0 code=68 "sample4" - 0 Error(s), 1 Warning(s).
1)it is clear file is there in that name 2)i have removed space though it shows warning message(not error message). 3)----------------------------- 4)access rights are provided(using property, i have checked it)
3)i used to set the path in the following manner is it correct? project workspace>source group1>right click>add files to group 'source group'>msdelay.c
is there any other procedure to set the path?
hi andy neil, i followed your reference,according to the definition given in the thread, i tried to solve the warning by adding include file in the below method try 1)workspace>target1 right click>add files to target1>c51>msdelay try 2)workspace>source group1 right click>add files to source group>c51>msdelay