0

I installed gcc-3.4 to Debian 7.8 and create symbolic link /usr/bin/gcc. When I typed gcc --version I get:

gcc (GCC) 3.4.6 (Debian 3.4.6.-9)

Then I wrote simple C program.

#include <stdio.h>

int main(int argc, char **argv)
{
    printf("hello");
    return 0;
}

But I get tons of error messages. I think problem is gcc-3.4 use gcc-4.7 (default gcc on system) header files. I downloaded gcc-3.4 from gcc website and type :

gcc untitled.c -I/home/asd/Desktop/gcc-3.4

but not work. How can I use header files of gcc-3.4 when compiling?

The errors start out like

In file included from /usr/include/stdio.h:28,
                 from untitled.c:1:
/usr/include/features.h:323:26: bits/predefs.h: No such file or directory
/usr/include/features.h:356:25: sys/cdefs.h: No such file or directory
/usr/include/features.h:388:23: gnu/stubs.h: No such file or directory
In file included from /usr/include/stdio.h:34,
                 from untitled.c:1:
/usr/lib/gcc/i486-linux-gnu/3.4.6/include/stddef.h:213: error: syntax error before "typedef"
In file included from untitled.c:1:
/usr/include/stdio.h:36:25: bits/types.h: No such file or directory
In file included from untitled.c:1:
/usr/include/stdio.h:49: error: syntax error before "typedef"
/usr/include/stdio.h:54: error: syntax error before "__USING_NAMESPACE_STD"
/usr/include/stdio.h: In function `__USING_NAMESPACE_STD':
/usr/include/stdio.h:65: error: storage class specified for parameter `__FILE'
In file included from /usr/include/_G_config.h:20,
                 from /usr/include/libio.h:32,
                 from /usr/include/stdio.h:75,
                 from untitled.c:1:
/usr/include/wchar.h:95: error: storage class specified for parameter `__mbstate_t'
In file included from /usr/include/libio.h:32,
                 from /usr/include/stdio.h:75,
                 from untitled.c:1:
/usr/include/_G_config.h:24: error: syntax error before "__off_t"
/usr/include/_G_config.h:29: error: syntax error before "__off64_t"
/usr/include/_G_config.h:53: error: storage class specified for parameter `_G_int16_t'
/usr/include/_G_config.h:54: error: storage class specified for parameter `_G_int32_t'
/usr/include/_G_config.h:55: error: storage class specified for parameter `_G_uint16_t'
/usr/include/_G_config.h:56: error: storage class specified for parameter `_G_uint32_t'
In file included from /usr/include/libio.h:53,
                 from /usr/include/stdio.h:75,
                 from untitled.c:1:
/usr/lib/gcc/i486-linux-gnu/3.4.6/include/stdarg.h:43: error: storage class specified for parameter `__gnuc_va_list'
In file included from /usr/include/stdio.h:75,
                 from untitled.c:1:
/usr/include/libio.h:180: error: storage class specified for parameter `_IO_lock_t'
/usr/include/libio.h:300: error: syntax error before "__off_t"
/usr/include/libio.h:310: error: syntax error before "_IO_lock_t"
/usr/include/libio.h:338: error: syntax error before '}' token
/usr/include/libio.h:341: error: storage class specified for parameter `_IO_FILE'
/usr/include/libio.h:346: error: storage class specified for parameter `_IO_2_1_stdin_'
/usr/include/libio.h:347: error: storage class specified for parameter `_IO_2_1_stdout_'
/usr/include/libio.h:348: error: storage class specified for parameter `_IO_2_1_stderr_'
/usr/include/libio.h:364: error: storage class specified for parameter `__ssize_t'
/usr/include/libio.h:364: error: syntax error before "__io_read_fn"
/usr/include/libio.h:372: error: storage class specified for parameter `__ssize_t'
/usr/include/libio.h:372: error: redefinition of parameter '__ssize_t'
/usr/include/libio.h:364: error: previous definition of '__ssize_t' was here

The full output of running gcc is available at http://pastebin.com/jFRihqUw

  • 1
    I kept the question title in my edit just now, but I believe you are looking at this from the wrong end. stdio.h and friends are related not to GCC (the compiler), but to glibc (the standard C library). – a CVn Jun 8 '15 at 8:43
  • There is no glibc package in my system. There are glibc-doc, glibc-doc-reference and glibc-source packages. What should I do? – user4757345 Jun 8 '15 at 13:02
0

install gcc & g++ For example In linux kali run this in terminal

apt-get install gcc g++

Then replace path with correct path In my case correct path is

arm-linux-gnueabihf/bits/predefs.h

0

install gcc & g++ For example In linux kali run this in terminal

apt-get install gcc g++

for ubuntu use sudo before apt Then replace path with correct path In my case arm-linux-gnueabihf/bits/predefs.h>

because i have arm base device Follow this for next comming path errors But by doing this you will get several path issue So best aproch is

COPY asm , bits , sys & other folder if getting path error to include folder from arm-linux-gnueabihf folder

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.