Author Topic: [Help][C] Problem with including header files in gcc  (Read 899 times)

0 Members and 1 Guest are viewing this topic.

Offline parad0x

  • VIP
  • Royal Highness
  • *
  • Posts: 638
  • Cookies: 118
    • View Profile
[Help][C] Problem with including header files in gcc
« on: July 03, 2014, 07:50:03 am »
I was writing dome some sort of C programs, usually basic stuff but when I tried to compile one, it said ]fatal error: stdio.h: No such file or

directory[\b].

Here is my code for that program :
Code: (C) [Select]
#include<stdio.h>

int main(){

printf("Testing....\n");

return 0;

}

Then I remembered something and located the stdio.h file, it gave me /usr/lib/syslinux/com32/include/stdio.h, then once again I edited

my program to look like this
Code: (C) [Select]
#include "/usr/lib/syslinux/com32/include/stdio.h"

int main(){

printf("Testing....\n");

return 0;

}

I thought it would work but then, it gave me another error,  much like the old one.
The error said In file included from try.c:1:0:
/usr/lib/syslinux/com32/include/stdio.h:8:26: fatal error: klibc/extern.h: No such file or directory
 #include <klibc/extern.h>
                          ^
compilation terminated.


The problem is not only with stdio.h header file, but with all others header files that I am trying to use.

My OS is Linux Mint 17 Quiana and I am using gcc compiler to compile all this.

Can anybody tell me how to correct all this??
I really need help with it.

Offline Raavgo

  • Peasant
  • *
  • Posts: 88
  • Cookies: 12
  • On my way from a n00b to a PRO
    • View Profile
Re: [Help][C] Problem with including header files in gcc
« Reply #1 on: July 03, 2014, 01:07:09 pm »
Well this is odd #include <stdio.h> should work fine, are you sure that gcc is working correctly?
For testing purpose you could copy stdio.h in the directory of your source file and include it with #include "stdio.h".
If this is still not working you got a problem with your compiler, I guess.



Offline parad0x

  • VIP
  • Royal Highness
  • *
  • Posts: 638
  • Cookies: 118
    • View Profile
Re: [Help][C] Problem with including header files in gcc
« Reply #2 on: July 03, 2014, 02:45:24 pm »
I appreciate that you want to help me but you should have really thought that waht you are gonna post is obvious and even I know it. It would be better if you tell me  solution instead of the problem. Btw, +1 for that attitude.

Offline Schalla

  • VIP
  • Peasant
  • *
  • Posts: 81
  • Cookies: 29
    • View Profile
Re: [Help][C] Problem with including header files in gcc
« Reply #3 on: July 03, 2014, 05:22:59 pm »
Have you installed the build-essential package?


Quote
sudo apt-get install build-essential


I had similar issues also with a frehs installation of LM 17.

Offline ArkPhaze

  • Peasant
  • *
  • Posts: 136
  • Cookies: 20
  • null terminated
    • View Profile
Re: [Help][C] Problem with including header files in gcc
« Reply #4 on: July 04, 2014, 04:56:16 am »
Do a reinstall, there's something wrong with your installation.
sig=: ArkPhaze

[ J/ASM/.NET/C/C++ - Software Engineer ]