Я установил gcc-3.4
в Debian 7.8
и создал символическую ссылку /usr/bin/gcc
.
Когда я набрал gcc --version
я получил:
gcc (GCC) 3.4.6 (Debian 3.4.6.-9)
Тогда я написал простую программу на Си.
#include <stdio.h>
int main(int argc, char **argv)
{
printf("hello");
return 0;
}
Но я получаю тонны сообщений об ошибках. Я думаю, проблема в том, что gcc-3.4
использует заголовочные файлы gcc-4.7
(по умолчанию gcc в системе). Я скачал gcc-3.4
с сайта gcc и набрал:
gcc untitled.c -I/home/asd/Desktop/gcc-3.4
но не работа. Как я могу использовать заголовочные файлы gcc-3.4
при компиляции?
Ошибки начинаются как
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
Полный вывод работающего gcc доступен по адресу http://pastebin.com/jFRihqUw.