编译C/C++源文件
liuyifeng
|
1#
liuyifeng 发表于 2008-11-11 16:49
编译C/C++源文件
为什么我装了红旗linux6以后,在控制台里输入gcc或g++无效,提示找不到此命令?只有gcc32 和g++32有效。但是用这两个命令边一个helloworld.c或helloworld.cpp编译不了。
用gcc32编译hellolworld.c结果如下: #gcc32 helloworld.c hello.c:1:18: stdio.h: 没有那个文件或目录 用g++32编译helloworld.cpp结果如下(一堆错误,救命呀): [root@liulinux ~]# g++32 hello.cpp In file included from /usr/include/c++/3.2.3/i386-pc-linux/bits/c++config.h:34, from /usr/include/c++/3.2.3/iostream:44, from hello.cpp:1: /usr/include/c++/3.2.3/i386-pc-linux/bits/os_defines.h:39:22: features.h: 没有那个文件或目录 /usr/include/c++/3.2.3/i386-pc-linux/bits/os_defines.h:46:23: gnu/types.h: 没有 那个文件或目录 In file included from /usr/include/c++/3.2.3/i386-pc-linux/bits/c++config.h:34, from /usr/include/c++/3.2.3/iostream:44, from hello.cpp:1: /usr/include/c++/3.2.3/i386-pc-linux/bits/os_defines.h:47: syntax error before `;' token In file included from /usr/include/c++/3.2.3/i386-pc-linux/bits/c++io.h:35, from /usr/include/c++/3.2.3/bits/fpos.h:44, from /usr/include/c++/3.2.3/iosfwd:46, from /usr/include/c++/3.2.3/ios:44, from /usr/include/c++/3.2.3/ostream:45, from /usr/include/c++/3.2.3/iostream:45, from hello.cpp:1: /usr/include/c++/3.2.3/cstdio:52:19: stdio.h: 没有那个文件或目录 In file included from /usr/include/c++/3.2.3/i386-pc-linux/bits/c++io.h:35, from /usr/include/c++/3.2.3/bits/fpos.h:44, from /usr/include/c++/3.2.3/iosfwd:46, from /usr/include/c++/3.2.3/ios:44, from /usr/include/c++/3.2.3/ostream:45, from /usr/include/c++/3.2.3/iostream:45, from hello.cpp:1: /usr/include/c++/3.2.3/cstdio:99: `FILE' not declared /usr/include/c++/3.2.3/cstdio:100: `fpos_t' not declared /usr/include/c++/3.2.3/cstdio:102: `clearerr' not declared /usr/include/c++/3.2.3/cstdio:103: `fclose' not declared /usr/include/c++/3.2.3/cstdio:104: `feof' not declared /usr/include/c++/3.2.3/cstdio:105: `ferror' not declared /usr/include/c++/3.2.3/cstdio:106: `fflush' not declared /usr/include/c++/3.2.3/cstdio:107: `fgetc' not declared /usr/include/c++/3.2.3/cstdio:108: `fgetpos' not declared /usr/include/c++/3.2.3/cstdio:109: `fgets' not declared /usr/include/c++/3.2.3/cstdio:110: `fopen' not declared /usr/include/c++/3.2.3/cstdio:111: `fprintf' not declared /usr/include/c++/3.2.3/cstdio:112: `fputc' not declared /usr/include/c++/3.2.3/cstdio:113: `fputs' not declared /usr/include/c++/3.2.3/cstdio:114: `fread' not declared /usr/include/c++/3.2.3/cstdio:115: `freopen' not declared /usr/include/c++/3.2.3/cstdio:116: `fscanf' not declared /usr/include/c++/3.2.3/cstdio:117: `fseek' not declared /usr/include/c++/3.2.3/cstdio:118: `fsetpos' not declared /usr/include/c++/3.2.3/cstdio:119: `ftell' not declared /usr/include/c++/3.2.3/cstdio:120: `fwrite' not declared /usr/include/c++/3.2.3/cstdio:121: `getc' not declared /usr/include/c++/3.2.3/cstdio:122: `getchar' not declared /usr/include/c++/3.2.3/cstdio:123: `gets' not declared /usr/include/c++/3.2.3/cstdio:124: `perror' not declared /usr/include/c++/3.2.3/cstdio:125: `printf' not declared /usr/include/c++/3.2.3/cstdio:126: `putc' not declared /usr/include/c++/3.2.3/cstdio:127: `putchar' not declared /usr/include/c++/3.2.3/cstdio:128: `puts' not declared /usr/include/c++/3.2.3/cstdio:129: `remove' not declared /usr/include/c++/3.2.3/cstdio:130: `rename' not declared /usr/include/c++/3.2.3/cstdio:131: `rewind' not declared /usr/include/c++/3.2.3/cstdio:132: `scanf' not declared /usr/include/c++/3.2.3/cstdio:133: `setbuf' not declared /usr/include/c++/3.2.3/cstdio:134: `setvbuf' not declared /usr/include/c++/3.2.3/cstdio:135: `sprintf' not declared /usr/include/c++/3.2.3/cstdio:136: `sscanf' not declared /usr/include/c++/3.2.3/cstdio:137: `tmpfile' not declared /usr/include/c++/3.2.3/cstdio:138: `tmpnam' not declared /usr/include/c++/3.2.3/cstdio:139: `ungetc' not declared /usr/include/c++/3.2.3/cstdio:140: `vfprintf' not declared /usr/include/c++/3.2.3/cstdio:141: `vprintf' not declared /usr/include/c++/3.2.3/cstdio:142: `vsprintf' not declared /usr/include/c++/3.2.3/cstdio:155: `snprintf' not declared /usr/include/c++/3.2.3/cstdio:156: `vfscanf' not declared /usr/include/c++/3.2.3/cstdio:157: `vscanf' not declared /usr/include/c++/3.2.3/cstdio:158: `vsnprintf' not declared /usr/include/c++/3.2.3/cstdio:159: `vsscanf' not declared /usr/include/c++/3.2.3/cstdio:164: `snprintf' not declared /usr/include/c++/3.2.3/cstdio:165: `vfscanf' not declared /usr/include/c++/3.2.3/cstdio:166: `vscanf' not declared /usr/include/c++/3.2.3/cstdio:167: `vsnprintf' not declared /usr/include/c++/3.2.3/cstdio:168: `vsscanf' not declared In file included from /usr/include/c++/3.2.3/i386-pc-linux/bits/gthr.h:98, from /usr/include/c++/3.2.3/i386-pc-linux/bits/c++io.h:37, from /usr/include/c++/3.2.3/bits/fpos.h:44, from /usr/include/c++/3.2.3/iosfwd:46, from /usr/include/c++/3.2.3/ios:44, from /usr/include/c++/3.2.3/ostream:45, from /usr/include/c++/3.2.3/iostream:45, from hello.cpp:1: /usr/include/c++/3.2.3/i386-pc-linux/bits/gthr-default.h:37:21: pthread.h: 没有 那个文件或目录 In file included from /usr/include/c++/3.2.3/i386-pc-linux/bits/gthr.h:98, from /usr/include/c++/3.2.3/i386-pc-linux/bits/c++io.h:37, from /usr/include/c++/3.2.3/bits/fpos.h:44, from /usr/include/c++/3.2.3/iosfwd:46, from /usr/include/c++/3.2.3/ios:44, from /usr/include/c++/3.2.3/ostream:45, from /usr/include/c++/3.2.3/iostream:45, from hello.cpp:1: /usr/include/c++/3.2.3/i386-pc-linux/bits/gthr-default.h:39: syntax error before `;' token /usr/include/c++/3.2.3/i386-pc-linux/bits/gthr-default.h:40: syntax error before `;' token /usr/include/c++/3.2.3/i386-pc-linux/bits/gthr-default.h:41: syntax error before `;' token /usr/include/c++/3.2.3/i386-pc-linux/bits/gthr-default.h: In function `int __gthread_active_p()': /usr/include/c++/3.2.3/i386-pc-linux/bits/gthr-default.h:83: `pthread_create' undeclared (first use this function) /usr/include/c++/3.2.3/i386-pc-linux/bits/gthr-default.h:83: (Each undeclared identifier is reported only once for each function it appears in.) /usr/include/c++/3.2.3/i386-pc-linux/bits/gthr-default.h: At global scope: /usr/include/c++/3.2.3/i386-pc-linux/bits/gthr-default.h:438: `__gthread_once_t ' was not declared in this scope /usr/include/c++/3.2.3/i386-pc-linux/bits/gthr-default.h:438: `once' was not declared in this scope /usr/include/c++/3.2.3/i386-pc-linux/bits/gthr-default.h:438: `func' was not declared in this scope /usr/include/c++/3.2.3/i386-pc-linux/bits/gthr-default.h:438: syntax error before `)' token /usr/include/c++/3.2.3/i386-pc-linux/bits/gthr-default.h:438: `__gthread_once' declared as an `inline' variable /usr/include/c++/3.2.3/i386-pc-linux/bits/gthr-default.h:438: initializer list being treated as compound expression /usr/include/c++/3.2.3/i386-pc-linux/bits/gthr-default.h:438: syntax error before `)' token /usr/include/c++/3.2.3/i386-pc-linux/bits/gthr-default.h:447: `__gthread_key_t' was not declared in this scope /usr/include/c++/3.2.3/i386-pc-linux/bits/gthr-default.h:447: `key' was not declared in this scope /usr/include/c++/3.2.3/i386-pc-linux/bits/gthr-default.h:447: `dtor' was not declared in this scope /usr/include/c++/3.2.3/i386-pc-linux/bits/gthr-default.h:447: syntax error before `*' token /usr/include/c++/3.2.3/i386-pc-linux/bits/gthr-default.h: In function `int __gthread_key_create(...)': /usr/include/c++/3.2.3/i386-pc-linux/bits/gthr-default.h:453: `__gthread_key_t' undeclared (first use this function) /usr/include/c++/3.2.3/i386-pc-linux/bits/gthr-default.h:453: syntax error before `,' token /usr/include/c++/3.2.3/i386-pc-linux/bits/gthr-default.h:454: cannot declare static function inside another function /usr/include/c++/3.2.3/i386-pc-linux/bits/gthr-default.h: In function `int __gthread_key_dtor(...)': /usr/include/c++/3.2.3/i386-pc-linux/bits/gthr-default.h:456: `ptr' undeclared (first use this function) /usr/include/c++/3.2.3/i386-pc-linux/bits/gthr-default.h:457: `key' undeclared (first use this function) /usr/include/c++/3.2.3/i386-pc-linux/bits/gthr-default.h:457: ` pthread_setspecific' undeclared (first use this function) /usr/include/c++/3.2.3/i386-pc-linux/bits/gthr-default.h:463: syntax error before `)' token /usr/include/c++/3.2.3/i386-pc-linux/bits/gthr-default.h:464: cannot declare static function inside another function /usr/include/c++/3.2.3/i386-pc-linux/bits/gthr-default.h: In function `int __gthread_key_delete(...)': /usr/include/c++/3.2.3/i386-pc-linux/bits/gthr-default.h:465: ` pthread_key_delete' undeclared (first use this function) /usr/include/c++/3.2.3/i386-pc-linux/bits/gthr-default.h:469: syntax error before `)' token /usr/include/c++/3.2.3/i386-pc-linux/bits/gthr-default.h:470: cannot declare static function inside another function /usr/include/c++/3.2.3/i386-pc-linux/bits/gthr-default.h: In function `void* __gthread_getspecific(...)': /usr/include/c++/3.2.3/i386-pc-linux/bits/gthr-default.h:471: ` pthread_getspecific' undeclared (first use this function) /usr/include/c++/3.2.3/i386-pc-linux/bits/gthr-default.h:475: syntax error before `,' token /usr/include/c++/3.2.3/i386-pc-linux/bits/gthr-default.h:476: cannot declare static function inside another function /usr/include/c++/3.2.3/i386-pc-linux/bits/gthr-default.h: In function `int __gthread_setspecific(...)': /usr/include/c++/3.2.3/i386-pc-linux/bits/gthr-default.h:481: ` __gthread_mutex_t' undeclared (first use this function) /usr/include/c++/3.2.3/i386-pc-linux/bits/gthr-default.h:481: `mutex' undeclared (first use this function) /usr/include/c++/3.2.3/i386-pc-linux/bits/gthr-default.h:482: ` __gthread_mutex_lock' declared as an `inline' variable /usr/include/c++/3.2.3/i386-pc-linux/bits/gthr-default.h:482: confused by earlier errors, bailing out [root@liulinux ~]# 有人说看装了glibc没,我找了一下,确实装了呀。高手帮忙呀。 |