LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-14-2007, 02:29 PM   #1
spargonaut
Member
 
Registered: Jun 2004
Distribution: debian etch
Posts: 40

Rep: Reputation: 15
gcc not finding stdio.h, and other headers


howdy folks,

long story short ( as possible ).
professor gave me some code, along with makefiles, and expects me to complete my homework. I ran the makefiles, only to notice that i had not yet install gcc ( smacks for forehead ). So, i apt-get me some gcc. installs just fine. ahem, no errors, no complaints. Try the makefile once again, to no avail. this time its complaining about missing header files. stdio.h, as well as others.

I attempt to compile everyones favorite helloWorld.c to find out if its the profs code, or my machine, only to discover, that i can't even compile helloWorld.c

i get the following errors:
stoopid.c:1:18: error: stdio.h: No such file or directory
stoopid.c: In function ‘main’:
stoopid.c:6: warning: incompatible implicit declaration of built-in function ‘printf’

note: stoopid.c => helloWorld.c

I have located stdio.h, so i know its on my machine, only, not in the /usr/include directory.
it is located here:
koala:/usr/lib/gcc/i486-linux-gnu/4.1.2/include/ssp

i tried copying stdio.h to /usr/include, only to find that it depended on ssp.h
i then realized that just copying the files might not be such a good idea.

I did some searching on google, this forum, and a couple others, and have found similar problems, but nothing close enough to help me.

would it work if i just made a symlink from /usr/include to the other directory?
( ie: the ln -s command )

any other suggestions?
any suggested readings you might be able to offer?
( i tried man gcc and gcc --help with no luck )

thanks ya'll.

ahh yes, the specifics:
debian etch 2.6.18-3-486
gcc version 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)

and when i issued the command: gcc -v
it spit all this out at me:
koala:/usr/lib/gcc/i486-linux-gnu/4.1.2/include/ssp# gcc -v
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug --enable-mpfr --with-tune=i686 --enable-checking=release i486-linux-gnu
Thread model: posix
gcc version 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)

Last edited by spargonaut; 02-14-2007 at 02:31 PM.
 
Old 02-14-2007, 09:17 PM   #2
St.Jimmy
Member
 
Registered: Jun 2006
Location: Boaz,Alabama
Distribution: Ubuntu 10.10 / Windows 7 Pro 64-Bit / Snow Leopard 10.6.4 64-Bit
Posts: 152

Rep: Reputation: 30
try ls -l /usr/include /path/to/files , should work
 
Old 02-14-2007, 09:26 PM   #3
spargonaut
Member
 
Registered: Jun 2004
Distribution: debian etch
Posts: 40

Original Poster
Rep: Reputation: 15
do you mean:
ln -l /usr/include /path/to/files
?

thats what i was nervous about doing before.

in the mean time, i have discovered that installing the 'build-essentials' package cleared up the stdio.h: not found problem, but i have since run into another problem, this one more specific to the code that i'm trying to compile, ahem, make.
( specifically, its complaining about the -lXaw flag being used with the gcc command in the make file ).

unfortunately, i fear that getting that resolved consists of me getting much more familiar with gcc, getting help from my instructor, more toiling and reading, and every combination thereof.

thanks for the feedback!
( btw, if anyone can explain what the -lXaw flag does with gcc, it would be greatly appreciated. thx! )
 
Old 02-15-2007, 11:31 AM   #4
studioj
Member
 
Registered: Oct 2006
Posts: 460

Rep: Reputation: 31
try this line at the bottom of your includes
Code:
using namespace std;
if you still have troubles you have to give us exact copy paste commands you use and output you get.
even give us exact copy paste code/makefile whatever you are using.

Last edited by studioj; 02-15-2007 at 11:36 AM.
 
Old 02-15-2007, 11:38 AM   #5
spargonaut
Member
 
Registered: Jun 2004
Distribution: debian etch
Posts: 40

Original Poster
Rep: Reputation: 15
nope.
thats c++
i'm using C
( and its not working )

thanks for the input though.
 
Old 02-15-2007, 11:02 PM   #6
studioj
Member
 
Registered: Oct 2006
Posts: 460

Rep: Reputation: 31
yea you are right sorry.
apon further reflection something is wrong with your glibc installation.
perhaps you don't have glibc developement files.
some linux distributions actually put some glibc files into a glibc-headers package.
 
Old 02-15-2007, 11:32 PM   #7
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 78
Quote:
Originally Posted by spargonaut
in the mean time, i have discovered that installing the 'build-essentials' package cleared up the stdio.h: not found problem, but i have since run into another problem, this one more specific to the code that i'm trying to compile, ahem, make.
( specifically, its complaining about the -lXaw flag being used with the gcc command in the make file ).
( btw, if anyone can explain what the -lXaw flag does with gcc, it would be greatly appreciated. thx! )
Any flags passed to gcc that start with a lowercase l indicate the following token is the name of a library stripped of the “lib” prefix (e.g., to link your app to libcurses, you should pass the flag “-lcurses”). These flags are actually carried over when gcc executes ld after compilation. So “-lXaw” means that your app should link against libXaw, which (in case you don’t know) is the X athena widget library. So, you probably need to install the “X development” package or something. Perhaps it already is on your system, but ld cannot find it. In this case, there are many possibilities, and no sure method to solve your problem without more information. There must be literature somewhere explaining the unix library system in further detail.

P.S.
Did you know there is a library named “libiberty” (that way, when linking, you specify the flag “-liberty”).
 
Old 02-16-2007, 02:44 PM   #8
spargonaut
Member
 
Registered: Jun 2004
Distribution: debian etch
Posts: 40

Original Poster
Rep: Reputation: 15
osor, you hit the nail on the head!
last night, my instructor gave pretty much the same answer and explanation you did.
thank you very much for explaining that to a newb.

the X development package was exactly what i needed. ( xorg.dev )

once i got that installed, everything worked perfectly.
also, i had no clue what Xaw stood for, nor what it did.
now i've got some research to do, looking up that library, as well as the iberty library.

thanks a ton for the help!
and thanks to everyone else who made suggestions.

now i'm off to break something else.
 
Old 02-16-2007, 06:52 PM   #9
mohama
Member
 
Registered: May 2005
Location: solar-system->earth->northern hemisphere
Distribution: ubunutu+knoppix+suse
Posts: 197

Rep: Reputation: 31
hello ,
i read your posts quickly ... i don't see any reason to link or need any development tools in your machine , if you have gcc installed , since in order to use stdio library you only need to include it's header in your code and there is no need in linkage which is not the case in math library for example ...
i have a question ..
is the line including the stdio.h written like this :
#include <stdio.h>

or like this :
#include "stdio.h"

in the first case , it will search it in all paths exists in your PATH ENVIROMENT
in the second case it will search it in the ./ , which is this directory .

p.s : what editor you use ?? i would suggest you use emacs to code and the shell to run and compile ...!

good luck and enjoy the c/cpp programming languages !!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
GCC 3.2.3 gives error with <stdio.h> on slackware 9.1 Daid Slackware 4 03-01-2009 10:53 PM
gcc not finding stdio.h ChrisScott Programming 2 02-06-2007 08:00 AM
gcc won't find stdio.h .... or anything else either Thulas Programming 3 02-24-2005 12:22 AM
gcc and stdio in 9.1 iansworld SUSE / openSUSE 1 10-19-2004 01:35 PM
stdio problem in gcc iansworld Linux - Software 0 10-19-2004 10:12 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:07 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration