2

I keep getting this error, when trying to compile my C program in SCO (using gcc).

I have had a look on Google, and found this other forum: Linux Questions, and that guy had the exact same issue as I am getting. So I tried his solution, which is adding a line at the top of the program.c file:

#include "err.h"

I tried compiling again, and now I get one line back:

program.c:5: err.h: No such file or directory
  • Do I need to add / install to get that file?
  • Where would this file be in my file-system?

Thanks in advance.

EDIT

vi hello.c:

/* Hello World program */

#include<stdio.h>

main()
{
    printf("Hello World");

}

gcc -v hello.c:

Reading specs from /usr/local/lib/gcc-lib/i386-pc-sco3.2v5.0.5/2.95.2/specs
gcc version 2.95.2 19991024 (release)
 /usr/local/lib/gcc-lib/i386-pc-sco3.2v5.0.5/2.95.2/cpp -lang-c -v -D__GNUC__=2 -D__GNUC_MINOR__=95 -Asystem(svr3) -Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__ -D__i386 -D__unix -D_SCO_DS=1 -D_M_I386 -D_M_XENIX -D_M_UNIX -D_STRICT_NAMES -D_SCO_XPG_VERS=4 -D_M_I86 -D_M_I86SM -D_M_INTERNAT -D_M_SDATA -D_M_STEXT -D_M_BITFIELDS -D_M_SYS5 -D_M_SYSV -D_M_SYSIII -D_M_WORDSWAP -Dunix -DM_I386 -DM_UNIX -DM_XENIX -D_SCO_ELF -D_SCO_C_DIALECT=1 hello.c /usr/tmp/cc1HX7yg.i
GNU CPP version 2.95.2 19991024 (release) (i386, SCO OpenServer 5 Syntax)
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/local/lib/gcc-lib/i386-pc-sco3.2v5.0.5/2.95.2/../../../../i386-pc-sco3.2v5.0.5/include
 /usr/local/lib/gcc-lib/i386-pc-sco3.2v5.0.5/2.95.2/include
 /usr/include
End of search list.
The following default directories have been omitted from the search path:
 /usr/local/lib/gcc-lib/i386-pc-sco3.2v5.0.5/2.95.2/../../../../include/g++-3
End of omitted list.
 /usr/local/lib/gcc-lib/i386-pc-sco3.2v5.0.5/2.95.2/cc1 /usr/tmp/cc1HX7yg.i -quiet -dumpbase hello.c -version -o /usr/tmp/cc4HAEHq.s
GNU C version 2.95.2 19991024 (release) (i386-pc-sco3.2v5.0.5) compiled by GNU C version  2.95.2 19991024 (release).
In file included from hello.c:3:
 /usr/include/stdio.h:140: parse error before `__gnuc_va_list'
 /usr/include/stdio.h:140: parse error before `__gnuc_va_list'
 /usr/include/stdio.h:140: parse error before `__gnuc_va_list'
9
  • From what I remember of your past questions, you still haven't installed gcc properly. Gcc needs its own copy of system headers, it looks like it isn't getting them. Aug 17, 2012 at 0:06
  • Thanks @Gilles, I remember now too. But I think I got it installed, as when I type gcc it shows: gcc: No input files. So I think it is installed now.
    – Kevdog777
    Aug 17, 2012 at 7:40
  • This shows that you have the binary in the right place, but not that you have the other parts. In particular, you probably don't have the right headers in the right place. To help you with this, we'd need to know exactly how you installed the compiler (as in, a copy-paste of all the commands you typed). Aug 17, 2012 at 8:04
  • Right @Gilles, I can't exactly remember, but I found out with my other questions. I used WinSCP (SSH) to copy a .tar.gz file to my /u/test/installgnu/gcc/ folder. I then went into the terminal, using PuTTY, and un-tarred the file. tar xzvf gcc-2.95.2pl1-dist.tar.gz - I seriously can't remember if I used the 2.95.2pl1-dist... or the 12.95.2pl1-VOLS.tar. I typed gcc -v` and got this back: /usr/local/lib/gcc-lib/i386-pc-sco3.2v5.0.5/2.95.2/specs gcc version 2.95.2 19991024 (release). Does that help?
    – Kevdog777
    Aug 17, 2012 at 8:20
  • Then using scoadmin software I installed gcc.
    – Kevdog777
    Aug 17, 2012 at 8:24

1 Answer 1

0

in C/C++ you have #include "" and #include <> , When you use "" It means you introduce your header file to compiler, So you need to -I in compile time such as:

gcc -I. -I../Includes program.c

-I get an argument as path of your includes files, When you use stdio or stdlib, they are default installed in gcc path and introduced to your gcc.

4
  • Thank you for that, I did that, and this is what is now returned (better): bash-3.1$ gcc -I. -I../opt/K/SKUNK99/Gcc/2.95.2pl1/usr/local/include/g++-3/ program.c program.c:19: vcl.h: No such file or directory program.c:22: windows.h: No such file or directory program.c:69: stdafx.h: No such file or directory
    – Kevdog777
    Aug 16, 2012 at 14:53
  • along with above path, add -I/usr/include Aug 16, 2012 at 15:09
  • So should the path say: gcc -I. -I/opt/K/SKUNK99/...? Sorry, I'm just confused.
    – Kevdog777
    Aug 16, 2012 at 15:13
  • I don't know SCO, but gcc has a default path When you run gcc -v You can find out its default path.enjoy it. Aug 16, 2012 at 15:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .