- ベストアンサー
cygwinのgccによるコンパイルがうまくいかない!エラーが出る理由と解決方法を教えてください
- cygwinを使用してgccをコンパイルしようとすると、エラーメッセージが表示され、コンパイルができません。
- mtuneオプションを変更して試みましたが、全くうまくいきませんでした。
- 解決策を教えてください!
- みんなの回答 (3)
- 専門家の回答
質問者が選んだベストアンサー
なんか、根本的なところでエラーになってる気がします。 一度、gcc関連一式を再インストールしてはどうでしょう? なお、 gcc はgcc3用のパッケージで、gcc4.5.3は gcc4パッケージになります。 gcc4で始まるパッケージがインストールされているかも、念の為チェックしてみては
その他の回答 (2)
- zwi
- ベストアンサー率56% (730/1282)
エラーコードを貼ってもらうと回答できると思います。
お礼
/stdio.h:249: error: parse error before "size_t" /usr/include/stdio.h:270: error: parse error before "size_t" /usr/include/stdio.h:272: error: parse error before "size_t" /usr/include/stdio.h:275: error: parse error before "__gnuc_va_list" /usr/include/stdio.h:277: error: parse error before "size_t" /usr/include/stdio.h:279: error: parse error before "size_t" /usr/include/stdio.h:281: error: parse error before "__gnuc_va_list" /usr/include/stdio.h:283: error: parse error before "__gnuc_va_list" /usr/include/stdio.h:285: error: parse error before "__gnuc_va_list" /usr/include/stdio.h:287: error: parse error before "__gnuc_va_list" /usr/include/stdio.h:289: error: parse error before "__gnuc_va_list" /usr/include/stdio.h:291: error: parse error before "__gnuc_va_list" /usr/include/stdio.h:293: error: parse error before "__gnuc_va_list" /usr/include/stdio.h:295: error: parse error before "__gnuc_va_list" /usr/include/stdio.h:297: error: parse error before "__gnuc_va_list" /usr/include/stdio.h:299: error: parse error before "__gnuc_va_list" /usr/include/stdio.h:301: error: parse error before "size_t" /usr/include/stdio.h:303: error: parse error before "size_t" /usr/include/stdio.h:305: error: parse error before "__gnuc_va_list" /usr/include/stdio.h:344: error: parse error before "size_t" /usr/include/stdio.h:347: error: parse error before "size_t" /usr/include/stdio.h:351: error: parse error before "__gnuc_va_list" /usr/include/stdio.h:362: error: parse error before "size_t" /usr/include/stdio.h:364: error: parse error before "size_t" /usr/include/stdio.h:389: error: parse error before "size_t" /usr/include/stdio.h:397: error: parse error before "_fread_r" /usr/include/stdio.h:405: error: parse error before "_fwrite_r" /usr/include/stdio.h:415: error: parse error before "size_t" /usr/include/stdio.h:433: error: parse error before "size_t" /usr/include/stdio.h:435: error: parse error before "size_t" /usr/include/stdio.h:445: error: parse error before "__gnuc_va_list" /usr/include/stdio.h:447: error: parse error before "size_t" /usr/include/stdio.h:449: error: parse error before "size_t" /usr/include/stdio.h:451: error: parse error before "__gnuc_va_list" /usr/include/stdio.h:453: error: parse error before "__gnuc_va_list" /usr/include/stdio.h:455: error: parse error before "__gnuc_va_list" /usr/include/stdio.h:457: error: parse error before "__gnuc_va_list" /usr/include/stdio.h:459: error: parse error before "__gnuc_va_list" /usr/include/stdio.h:461: error: parse error before "__gnuc_va_list" /usr/include/stdio.h:463: error: parse error before "__gnuc_va_list" /usr/include/stdio.h:465: error: parse error before "__gnuc_va_list" /usr/include/stdio.h:467: error: parse error before "__gnuc_va_list" /usr/include/stdio.h:469: error: parse error before "__gnuc_va_list" /usr/include/stdio.h:471: error: parse error before "__gnuc_va_list" /usr/include/stdio.h:473: error: parse error before "__gnuc_va_list" /usr/include/stdio.h:475: error: parse error before "__gnuc_va_list" /usr/include/stdio.h:477: error: parse error before "size_t" /usr/include/stdio.h:479: error: parse error before "size_t" /usr/include/stdio.h:481: error: parse error before "__gnuc_va_list" /usr/include/stdio.h:483: error: parse error before "__gnuc_va_list" /usr/include/stdio.h:489: error: parse error before "size_t" /usr/include/stdio.h:490: error: parse error before "size_t" /usr/include/stdio.h:555: error: parse error before "size_t" /usr/include/stdio.h:557: error: parse error before "size_t" /usr/include/stdio.h: In function `__sgetc_r': /usr/include/stdio.h:602: error: 不完全型のポインタへの間接参照 /usr/include/stdio.h:602: error: 不完全型のポインタへの間接参照 /usr/include/stdio.h:603: error: 不完全型のポインタへの間接参照 /usr/include/stdio.h:605: error: 不完全型のポインタへの間接参照 /usr/include/stdio.h:605: error: 不完全型のポイン
補足
[USER@?? /home]$ gcc test.c -o test.exe test.c:1: error: bad value (generic) for -mtune= switch [USER@?? /home]$ gcc test.c -o test.exe -mtune=native cc1: error: invalid parameter `l1-cache-size' cc1: error: invalid parameter `l1-cache-line-size' cc1: error: invalid parameter `l2-cache-size' [USER@?? /home]$ gcc test.c -o test.exe -mtune=athlon-xp In file included from test.c:1: /usr/include/stdlib.h:15:20: stddef.h: No such file or directory In file included from /usr/include/sys/reent.h:14, from /usr/include/stdlib.h:17, from test.c:1: /usr/include/sys/_types.h:72: error: parse error before "wint_t" /usr/include/sys/_types.h:74: error: parse error before '}' token /usr/include/sys/_types.h:75: error: parse error before '}' token In file included from /usr/include/stdlib.h:17, from test.c:1: /usr/include/sys/reent.h:215: error: parse error before "_mbstate_t" /usr/include/sys/reent.h:217: error: parse error before '}' token /usr/include/sys/reent.h:269: error: parse error before "_mbstate_t" /usr/include/sys/reent.h:620: error: parse error before "_mbstate_t" /usr/include/sys/reent.h:626: error: parse error before "_mbrlen_state" /usr/include/sys/reent.h:627: error: parse error before "_mbrtowc_state" /usr/include/sys/reent.h:628: error: parse error before "_mbsrtowcs_state" /usr/include/sys/reent.h:629: error: parse error before "_wcrtomb_state" /usr/include/sys/reent.h:630: error: parse error before "_wcsrtombs_state" /usr/include/sys/reent.h:632: error: parse error before '}' token /usr/include/sys/reent.h:642: error: parse error before '}' token /usr/include/sys/reent.h:656: error: parse error before '}' token In file included from /usr/include/stdlib.h:24, from test.c:1: /usr/include/cygwin/stdlib.h:28: error: parse error before "size_t" /usr/include/cygwin/stdlib.h:33: error: parse error before "size_t" /usr/include/cygwin/stdlib.h:40: error: parse error before "size_t" In file included from test.c:1: /usr/include/stdlib.h:73: error: parse error before "size_t" /usr/include/stdlib.h:78: error: parse error before "__nmemb" /usr/include/stdlib.h:92: error: parse error before "__size" /usr/include/stdlib.h:93: error: parse error before "size_t" /usr/include/stdlib.h:94: error: parse error before "size_t" /usr/include/stdlib.h:95: error: parse error before '*' token /usr/include/stdlib.h:96: error: parse error before "wchar_t" /usr/include/stdlib.h:97: error: parse error before "wchar_t" /usr/include/stdlib.h:98: error: parse error before "wchar_t" /usr/include/stdlib.h:99: error: parse error before "mbstowcs" /usr/include/stdlib.h:100: error: parse error before "_mbstowcs_r" /usr/include/stdlib.h:101: error: parse error before "wcstombs" /usr/include/stdlib.h:102: error: parse error before "_wcstombs_r" /usr/include/stdlib.h:119: error: parse error before "size_t" /usr/include/stdlib.h:119: error: parse error before ')' token /usr/include/stdlib.h:121: error: parse error before "size_t" /usr/include/stdlib.h:123: error: parse error before "size_t" /usr/include/stdlib.h:150: error: parse error before "size_t" In file included from test.c:2: /usr/include/stdio.h:37:20: stdarg.h: No such file or directory In file included from /usr/include/stdio.h:61, from test.c:2: /usr/include/sys/stdio.h:37: error: parse error before "size_t" /usr/include/sys/stdio.h:38: error: parse error before "size_t" In file included from test.c:2: /usr/include/stdio.h:177: error: parse error before "size_t" /usr/include/stdio.h:188: error: parse error before "__gnuc_va_list" /usr/include/stdio.h:190: error: parse error before "__gnuc_va_list" /usr/include/stdio.h:192: error: parse error before "__gnuc_va_list" /usr/include/stdio.h:205: error: parse error before "fread" /usr/include/stdio.h:206: error: parse error before "fwrite" /usr/include/stdio.h:247: error: parse error before "size_t" /usr/include
- papapa0427
- ベストアンサー率25% (371/1472)
>#include <stdlib.h> >#include <stdio.h> >int main(void) >{ >printf("Hello World!\n"); >return 0; >[EOF] って、閉じ括弧は? } がありません。
お礼
タへの間接参照 test.c:7:2: 警告: no newline at end of file test.c: At top level: /usr/include/sys/reent.h:655: error: storage size of `__sf' isn't known [USER@?? /home]$ gcc test.c -o test.exe -mtune=pentium4 In file included from test.c:1: /usr/include/stdlib.h:15:20: stddef.h: No such file or directory In file included from /usr/include/sys/reent.h:14, from /usr/include/stdlib.h:17, from test.c:1: /usr/include/sys/_types.h:72: error: parse error before "wint_t" /usr/include/sys/_types.h:74: error: parse error before '}' token /usr/include/sys/_types.h:75: error: parse error before '}' token In file included from /usr/include/stdlib.h:17, from test.c:1: /usr/include/sys/reent.h:215: error: parse error before "_mbstate_t" /usr/include/sys/reent.h:217: error: parse error before '}' token /usr/include/sys/reent.h:269: error: parse error before "_mbstate_t" /usr/include/sys/reent.h:620: error: parse error before "_mbstate_t" /usr/include/sys/reent.h:626: error: parse error before "_mbrlen_state" /usr/include/sys/reent.h:627: error: parse error before "_mbrtowc_state" /usr/include/sys/reent.h:628: error: parse error before "_mbsrtowcs_state" /usr/include/sys/reent.h:629: error: parse error before "_wcrtomb_state" /usr/include/sys/reent.h:630: error: parse error before "_wcsrtombs_state" /usr/include/sys/reent.h:632: error: parse error before '}' token /usr/include/sys/reent.h:642: error: parse error before '}' token /usr/include/sys/reent.h:656: error: parse error before '}' token In file included from /usr/include/stdlib.h:24, from test.c:1: /usr/include/cygwin/stdlib.h:28: error: parse error before "size_t" /usr/include/cygwin/stdlib.h:33: error: parse error before "size_t" /usr/include/cygwin/stdlib.h:40: error: parse error before "size_t" In file included from test.c:1: /usr/include/stdlib.h:73: error: parse error before "size_t" /usr/include/stdlib.h:78: error: parse error before "__nmemb" /usr/include/stdlib.h:92: error: parse error before "__size" /usr/include/stdlib.h:93: error: parse error before "size_t" /usr/include/stdlib.h:94: error: parse error before "size_t" /usr/include/stdlib.h:95: error: parse error before '*' token /usr/include/stdlib.h:96: error: parse error before "wchar_t" /usr/include/stdlib.h:97: error: parse error before "wchar_t" /usr/include/stdlib.h:98: error: parse error before "wchar_t" /usr/include/stdlib.h:99: error: parse error before "mbstowcs" /usr/include/stdlib.h:100: error: parse error before "_mbstowcs_r" /usr/include/stdlib.h:101: error: parse error before "wcstombs" /usr/include/stdlib.h:102: error: parse error before "_wcstombs_r" /usr/include/stdlib.h:119: error: parse error before "size_t" /usr/include/stdlib.h:119: error: parse error before ')' token /usr/include/stdlib.h:121: error: parse error before "size_t" /usr/include/stdlib.h:123: error: parse error before "size_t" /usr/include/stdlib.h:150: error: parse error before "size_t" In file included from test.c:2: /usr/include/stdio.h:37:20: stdarg.h: No such file or directory In file included from /usr/include/stdio.h:61, from test.c:2: /usr/include/sys/stdio.h:37: error: parse error before "size_t" /usr/include/sys/stdio.h:38: error: parse error before "size_t" In file included from test.c:2: /usr/include/stdio.h:177: error: parse error before "size_t" /usr/include/stdio.h:188: error: parse error before "__gnuc_va_list" /usr/include/stdio.h:190: error: parse error before "__gnuc_va_list" /usr/include/stdio.h:192: error: parse error before "__gnuc_va_list" /usr/include/stdio.h:205: error: parse error before "fread" /usr/include/stdio.h:206: error: parse error before "fwrite" /usr/include/stdio.h:247: error: parse error before "size_t" /usr/include/stdio.h:249: error: parse error before "size_t" /usr/include/stdio.h:270: error: parse error before "size_t" /usr/include/stdio.h:2
補足
指摘されるとわかっていましたが、コピーしたときに間違えただけです。送信してから閉じ括弧がないとわかりました。 実際には閉じ括弧はあるので大丈夫です。
お礼
gcc~gcc4系をすべて再インストールしたらコンパイルできました。 有難うございました。