Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

stdio.h not found... sometimes

Status
Not open for further replies.

Mellegem

Technical User
Apr 3, 2003
49
ZA
Hi all,

I'm new to C and when trying to recompile comlib.c I get the following errors,

<snip>
demos/comlibtest.c:7: stdio.h: No such file or directory
demos/comlibtest.c:8: stdlib.h: No such file or directory
In file included from include/comlib/serial.h:21,
from include/comlib/gps.h:27,
from include/comlib/comlib.h:103,
from demos/comlibtest.c:10:
include/comlib/types.h:22: cyg/infra/cyg_type.h: No such file or directory
In file included from include/comlib/gps.h:27,
from include/comlib/comlib.h:103,
from demos/comlibtest.c:10:
</snip>
However when I compile the following program
<code>
#include <stdio.h>
#include <stdlib.h>

main (){
printf("Hello World...\n");
return 0;
}
</code>

I get no errors. Anyideas as to my problem? Where to look?


 
normally cc is looking for include files in
/usr/include
maybe you changed the default path
the option -I/xxx in the makefile
will reset the include path
 
Hi

So is this line in the makefile wrong?

LDFLAGS=-L$(PKG_INSTALL_DIR)/lib -Wl,--gc-sections -nostartfiles -Ttarget.ld -nostdlib

or should I keep looking?
 
i am nearly sure in demos/comlibtest.c
your includes are wrong.
correct are:
#include <stdio.h>
#include <stdlib.h>
 
No, thats where the confusion comes in from comlib.c

<code>
#include <stdio.h>
#include <stdlib.h>

#include <comlib/comlib.h>
#include <comlib/target.h>
</code>

looks fine, but generates the error listed above.. You say theres nothing wrong with my LDFLAGS settings?

 
it's not a LDFLAGS but an INCLUDE question
what's: #include <comlib/comlib.h> ?
if the include path is correctly set
#include <comlib.h> is OK
else append to the make-line
-Ipath-where-comlib.h-lives

in include statement
<abc.h> means look for abc.h in include path
"abc.h" means look for abc.h in local dir
 
Thanks for the help, I had a variable that wasn't set right. These make files are mind boggling... [nosmiley]
 
no Mellegem
make is one of the BEST tools in unix,
it just need a little experience, a lot of patience
and tons of tenacity
 
Also, remember that lots of Makefiles are automatically generated by programs, not written by another person. Thus, they can get very long and strange and undercommented.

In those cases, it's often easier to understand the source file (often Makefile.in or Makefile.ac) used to generate the Makefile, since that was more likely written by another person.


Make is indeed powerful, and it pays to understand it since it's so ubiquitous, but I wouldn't say it's one of the best. For simple tasks it works fine, but for any kind of large project, it gets to be a pain to write or to read the makefiles.

There are other, more sophisticated project-building tools available that have learned from the shortcomings of Make and improved on it. A big reason that Make remains the de facto standard (at least in cases where source code is distributed) is that everybody has it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top