Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 02-20-2006, 07:22 PM   #1
LQ Newbie
Registered: Feb 2005
Location: East Coast
Distribution: FC 3
Posts: 9

Rep: Reputation: 0
Inconsistent Compilation

I'm compiling the following program:
#include <stdio.h>

void main()
printf("Hello World\n");
With the following include statement and the associated header file in the same directory as the .c file:
#include "stdio.h"
gcc will compile successfully using the following

$gcc -x none file.c

With the following include statement and the associated header file in /usr/include
#include <stdio.h>
gcc will not compile the file using any of the following

$gcc -x c file.c
$gcc -x none file.c
$gcc -std=c89 file.c about this...

If I compile a file with the stdio.h header in the same directory, a precompiled header is kicked out: stdio.h.gch

If that .gch file is moved to /usr/include then compilation will proceed without any errors when the following statement is used:
#include <stdio.h>
According to:

"...only one precompiled header may be used during any compilation..."

so this proves to be a solution for small projects.

More...if the following is entered, a list of syntax errors results:

$ pwd
$ gcc -x none stdio.h
/usr/include/stdio.h:21 error: syntax error before '*' token

Old 02-21-2006, 01:37 PM   #2
LQ Guru
Registered: Dec 2005
Location: Somewhere on the String
Distribution: Debian Wheezy (x86)
Posts: 6,094

Rep: Reputation: 272Reputation: 272Reputation: 272
Weird. Never seen that before. I tried to reproduce your results and couldn't...


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
inconsistent bash behavior? kornelix Linux - Software 1 12-15-2005 11:06 AM
Inconsistent permissions kosmonaft Linux - General 1 11-21-2005 11:21 PM
inconsistent ip resolution blahJake Linux - Networking 0 09-20-2004 11:28 PM
inconsistent logons giri2 Mandriva 0 08-17-2004 05:50 PM
inconsistent X server? rgiggs Mandriva 3 05-11-2004 10:32 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:15 AM.

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