CGIへのコンパイルエラー
初めまして。プログラミング暦はほとんどありません。javaを少しかじった程度です。今回Ajaxへ挑戦しようと思い、
http://itpro.nikkeibp.co.jp/article/COLUMN/20060115/227278/?ST=nettech
の予測補完インタフェースを作成しよとしています。
環境はfedoracore5でXPからのputyからの遠隔です。
complete.cをcomplete.cgiへコンパイルするときに、
[root@localhost html]# gcc -Wall -O2 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include complete.c -o complete.cgi -lglib-2.0 -lsary -lpthread
complete.c:1: error: stray ‘\357’ in program
complete.c:1: error: stray ‘\273’ in program
complete.c:1: error: stray ‘\277’ in program
complete.c:1: error: stray ‘#’ in program
complete.c:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘<’ token
In file included from complete.c:2:
/usr/include/string.h:39: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/string.h:43: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/string.h:52: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/string.h:59: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/string.h:62: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/string.h:66: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/string.h:88: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/string.h:96: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/string.h:102: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/string.h:109: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘strxfrm’
/usr/include/string.h:184: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘strcspn’
/usr/include/string.h:188: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘strspn’
/usr/include/string.h:242: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘strlen’
/usr/include/string.h:270: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/string.h:288: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/string.h:292: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/string.h:296: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/string.h:299: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/string.h:329: error: expected declaration specifiers or ‘...’ before ‘size_t’
In file included from /usr/include/string.h:417,
from complete.c:2:
/usr/include/bits/string2.h:969: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__strcspn_c1’
/usr/include/bits/string2.h:971: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__strcspn_c1’
/usr/include/bits/string2.h:979: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__strcspn_c2’
/usr/include/bits/string2.h:982: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__strcspn_c2’
/usr/include/bits/string2.h:991: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__strcspn_c3’
/usr/include/bits/string2.h:994: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__strcspn_c3’
とエラーがでます。どうしたらいいでしょうか?(文字数の関係で半分しか掲載できませんでした。)よろしくお願いいたします。
補足
お返事ありがとうございます。 エラーの桁表示があった訳ではないのですが、 int t0 = 0; の部分を削除してコンパイルしてみるとエラーが起きないのでやはりここが問題なのだと思います・・・ if(....) の中で定義した変数はその外へは持って出れないのでしょうか?