Como posso usar cabeçalhos antigos do gcc?

0

Instalei gcc-3.4 em Debian 7.8 e crie o link simbólico /usr/bin/gcc . Quando digitei gcc --version , obtenho:

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

Então eu escrevi um programa C simples.

#include <stdio.h>

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

Mas recebo toneladas de mensagens de erro. Eu acho que o problema é gcc-3.4 use gcc-4.7 (padrão gcc no sistema) arquivos de cabeçalho. Eu baixei gcc-3.4 do site do gcc e digite :

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

mas não funciona. Como posso usar arquivos de cabeçalho de gcc-3.4 ao compilar?

Os erros começam como

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

A saída completa da execução do gcc está disponível no link

    
por user4757345 08.06.2015 / 10:31

2 respostas

0

instale o gcc & g ++ Por exemplo, no linux kali, execute isso no terminal

apt-get install gcc g++

Em seguida, substitua o caminho pelo caminho correto No meu caso, o caminho correto é

arm-linux-gnueabihf/bits/predefs.h

    
por 23.12.2017 / 08:03
0

instale o gcc & g ++ Por exemplo, no linux kali, execute isso no terminal

apt-get install gcc g++

para o Ubuntu usar o sudo antes do apt Em seguida, substitua o caminho pelo caminho correto No meu caso arm-linux-gnueabihf / bits / predefs.h >

porque eu tenho o dispositivo de base de braço Siga isto para os próximos erros de caminho de entrada Mas ao fazer isso, você receberá vários problemas de caminho Então, o melhor é

COPY asm, bits, sys & outra pasta se estiver recebendo erro de caminho  para incluir pasta da pasta arm-linux-gnueabihf

    
por 23.12.2017 / 07:59