• 締切済み

pro*cにて

どなたかご存知でしたらお願いします。 PRO*Cを使用してコンパイルをしたところ、 下記エラーが発生しました。 サンプルプログラムを使用しており、文法的には問題ないとおもいます。 何が原因か解る方、よろしくお願いします。 Error (future) 355: "sample.c", line 267 # Function 'main' must return type 'int'. void main(argc, argv) ^^^^ Warning: 1 future errors were detected and ignored. Add a '+p' option to detect and fix them before they become fatal errors in a future release. Behavior of this ill-formed program is not guaranteed to match that of a well-formed program ld: Unsatisfied symbol "sqlcxt" in file sample.o 1 errors. ↓makeファイルの内容です。 /usr/oracle/product/10.2.0/bin/proc sample.pc cc sample.c

みんなの回答

  • VOT
  • ベストアンサー率45% (11/24)
回答No.1

>Error (future) 355: "sample.c", line 267 # Function 'main' must return >type 'int'. >void main(argc, argv) >^^^^ 書いてあるまんまでしょう。 C言語の main() 関数の戻り値は int 型です。それをデフォルトでエラーにするかどうかはコンパイラや環境次第なんでしょうがこのコンパイラはこうなんですかね。 確かに古い教科書やアホが書いた本やサイトにはこういう記述がありますが、間違いは間違いです。

j3h2o2nd
質問者

お礼

お礼が遅くなり申し訳ありません。 ご回答どうもありがとうございました。 ご指摘の通りintに変えたところ、無事コンパイルをクリアできました。 Pro*Cの設定はいろいろ手間がかかるようですね・・・ 何かクセっぽいところがありましたら、またご教授ください。

関連するQ&A

  • C++のコンパイルエラーが

    おこります。 --------------------------------- #include <stdio.h> int main(void) { printf("hello, world\n"); return 0; } -------------------------------------- をコンパイルするのですができません。 以下のエラーが出ます。 --------------------------------------- エラー E2209 sample.c 1: インクルードファイル 'stdio.h' をオープンできない 警告 W8065 sample.c 5: プロトタイプ宣言のない関数 'printf' の呼び出し(関数 main ) *** 1 errors in Compile *** -------------------------------------

  • Cのコンパイルができない

    学生です 現在「C 入門の入門」という本を使ってC言語を勉強し始めています この中でプログラムのコンパイルにチャレンジするにあたり #include <sudio.h> main () { printf("C programming"); return 0; } というプログラムを書き、コマンドプロンプトから c:\Source>bcc32 sample.c と入力したのですが、 Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland sample.c: エラー E2209 sample.c 1: インクルードファイル 'sudio.h' をオープンできない 警告 W8065 sample.c 4: プロトタイプ宣言のない関数 'printf' の呼び出し(関数 main ) *** 1 errors in Compile *** と表示され、コンパイルに失敗しました 参考書によるとCコンパイラの設定ミスであり、bcc32.cfg と ilink32.cfg を設定を見直せと書いてあったので必死に見直したのですが、参考書に書いてあるミスのどれも当てはまらず、何度cfgファイルを書き直しても同じ結果になってしまいました ついでに書いてあったミスとは ・C:\Borland\bcc55にBinディレクトリは存在するか? ・cfgファイルは存在するか? ・ファイルの拡張子は問題ないか?表示されているか? ・記述内容は間違っていないか? の4点です いったい何が問題なのでしょうか? まったくわからないのですが、どなたか思いつく方がいらっしゃいましたらお願いします

  • C言語ファイルのコンパイルができない。

    先日からVineLinux3.1を使い始めました。 C言語ファイルa.c(「a」という文字を出力するだけのごく簡単なものです。このファイル自体には問題はありません。)をコンパイルしようと cc a.c と入力すると、 a.c:2:9: #include は”ファイル名”あるいは<ファイル名>を必要とします a.c:3: error: stray '\241' in program a.c:3: error: stray '\241' in program a.c:3: error: stray '\241' in program a.c:3: error: stray '\241' in program a.c: 関数 'main' 内: a.c:6: error: stray '\241' in program a.c:6: error: stray '\241' in program a.c:6: error: stray '\241' in program a.c:6: error: stray '\241' in program a.c:6: error: stray '\241' in program a.c:6: error: stray '\241' in program a.c:6: error: stray '\241' in program a.c:6: error: stray '\241' in program a.c:4: 警告: 'main'の戻り値の型が 'int'ではありません と出てコンパイルできません。 Linuxのことはまだほとんど分からないので、できるだけ丁寧におしえていただけるとうれしいです。 よろしくお願いします。

  • C++でコンパイルするとwarningが出ます

    C++初心者です。 C++でコンパイルすると以下のようなwarningメッセージが出るのですが、どういう意味なんでしょうか?解決策があれば教えてください。 プログラム(sample.cpp) #include <iostream.h> main(){ cout << " sample \n"; } warningメッセージ In file included from /usr/include/c++/3.3.1/backward/iostream.h:31, from sample.cpp:1: /usr/include/c++/3.3.1/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider usin g one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <s stream> instead of the deprecated header <strstream.h>. To disable this warning use -Wno-deprecated

  • Borlandで組んだC+サンプルでエラーに

    borlandでc++のあるサイトのサンプルを動かそうとしたのですが、 C:\borland\work\stl_sample3>bcc32 stl_sample3.cpp Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland stl_sample3.cpp: エラー E2206 stl_sample3.cpp 22: 不正な文字 '$' (0x24)(関数 main() ) エラー E2206 stl_sample3.cpp 30: 不正な文字 '$' (0x24)(関数 main() ) エラー E2206 stl_sample3.cpp 33: 不正な文字 '$' (0x24)(関数 main() ) エラー E2206 stl_sample3.cpp 43: 不正な文字 '$' (0x24)(関数 main() ) エラー E2206 stl_sample3.cpp 45: 不正な文字 '$' (0x24)(関数 main() ) エラー E2206 stl_sample3.cpp 48: 不正な文字 '$' (0x24)(関数 main() ) *** 6 errors in Compile *** というエラーになりました。 22行目は map<string, vector<string> > $_POST; となっています。 もしかして、borland c++コンパイラでは$が使えないのでしょうか? VSでないとダメなのですか?

  • PostgreSQLをC言語でアクセスしようと

    PostgreSQL 8.4.8 文書にのっているサンプルプログラムの 例 30-1. libpq サンプルプログラム 1 #include <stdio.h> #include <stdlib.h> #include "libpq-fe.h" ・・・・・・・・・・・・・ をコピペしてコンパイルしたところ次のようなエラーがでました # gcc sample.c /tmp/cctZBolQ.o: In function `exit_nicely': sample.c:(.text+0xd): undefined reference to `PQfinish' /tmp/cctZBolQ.o: In function `main': sample.c:(.text+0x4a): undefined reference to `PQconnectdb' sample.c:(.text+0x5a): undefined reference to `PQstatus' sample.c:(.text+0x6a): undefined reference to `PQerrorMessage' sample.c:(.text+0xa5): undefined reference to `PQexec' sample.c:(.text+0xb5): undefined reference to `PQresultStatus' sample.c:(.text+0xc6): undefined reference to `PQerrorMessage' sample.c:(.text+0xed): undefined reference to `PQclear' sample.c:(.text+0x105): undefined reference to `PQclear' sample.c:(.text+0x119): undefined reference to `PQexec' sample.c:(.text+0x129): undefined reference to `PQresultStatus' sample.c:(.text+0x13a): undefined reference to `PQerrorMessage' sample.c:(.text+0x161): undefined reference to `PQclear' sample.c:(.text+0x179): undefined reference to `PQclear' sample.c:(.text+0x18d): undefined reference to `PQexec' sample.c:(.text+0x19d): undefined reference to `PQresultStatus' sample.c:(.text+0x1ae): undefined reference to `PQerrorMessage' sample.c:(.text+0x1d5): undefined reference to `PQclear' sample.c:(.text+0x1ed): undefined reference to `PQnfields' sample.c:(.text+0x20f): undefined reference to `PQfname' sample.c:(.text+0x26b): undefined reference to `PQgetvalue' sample.c:(.text+0x2a8): undefined reference to `PQntuples' sample.c:(.text+0x2ba): undefined reference to `PQclear' sample.c:(.text+0x2ce): undefined reference to `PQexec' sample.c:(.text+0x2de): undefined reference to `PQclear' sample.c:(.text+0x2f2): undefined reference to `PQexec' sample.c:(.text+0x302): undefined reference to `PQclear' sample.c:(.text+0x30e): undefined reference to `PQfinish' collect2: ld はステータス 1 で終了しました # # find /usr/include/ -name libpq*.h /usr/include/pgsql/internal/libpq-int.h /usr/include/pgsql/server/libpq/libpq-be.h /usr/include/pgsql/server/libpq/libpq.h /usr/include/pgsql/server/libpq/libpq-fs.h /usr/include/libpq/libpq-fs.h /usr/include/libpq-events.h /usr/include/libpq-fe.h # gcc -I/usr/include sample.c でもおなじです どうすればコンパイル出きるようになるでしょうか? よろしくお願いします

  • 書き込んだファイルに改行が入ってしまう

    最後のfp3で書き込んだファイルのsample.txtが Problem Solving and Program Design in CC : A Reference ManualC Primer PlusC How to ProgramC Programming for Engineering and Computer ScienceIntroduction to CProgramming Embedded Systems in C and C++Absolute Beginner's Guide to CNumerical Recipes in C : The Art of Scientific ComputingThe C Programming Language このように途中で改行されてしまいます。 これはBorlandの特徴で仕方がないことなんでしょうか。。 それともプログラムが間違ってるのでしょうか。 ご教授よろしくおねがいします。 if((fp3 = fopen("sample.txt","w")) == NULL){ printf("can't open"); return(-1);//強制終了 } else{//タイトルだけをサンプルに書き出す for(i=0;i<M;i++){ fprintf(fp3,"%s",book[i].title); } } fclose(fp3); fclose(fp2); fclose(fp1); return(0);//正常終了 }

  • 英文を訳して下さい。

    On the main line, the attack was stopped by the 18th Romanian infantry division along the line formed by the Teleorman River valley. Intending to continue the defence of the division, an Alpenkorps battalion from the vanguard of the 217th German infantry division occupied the village of Prunaru on the afternoon of November 14/27. In order to avoid being encircled and the forces having to retreat to a new position, General Alexandru Referandru, commander of the 18th infantry division, decided to attack the enemy in the vicinity of Drăgăneşti-Vlaşca, using the 43rd mixed brigade and the 2nd Roşiori cavalry regiment.

  • C言語、半角で打ち直しても多くのエラーメッセージ。

    いつも大変お世話になり、誠にありがとうございます。 標記の件。 下記に、コード、エラーメッセージを書きます。 コンパイルしたところ、多くのエラーメッセージが出ます。 こういうエラーメッセージの場合、誤って、全角で 打ってしまったのだと思い、全部を半角で打ち直します。 デモ、また大量のエラーメッセージが出ます。 全角スペースを半角で打ち直す「コツ」ってありますか? 是非とも教えてください。 ご多忙中のところ、度々申し訳ございません。 下記コードが何故コンパイルエラーを起こすのか どうか、ご回答の程宜しくお願い申し上げます。        記 コード /*文字と数値を出力する*/ #include <stdio.h> int main(void) { printf("%cは文字です。\n",'A'); printf("%dは整数です。\n",123); printf("%fは小数です。\n",10.5); return 0; } エラ-メッセージ C:\MinGW>gcc test1.c -o test1 test1.c:1:1: error: stray '\377' in program test1.c:1:2: error: stray '\376' in program test1.c:1:3: error: expected identifier or '(' before '/' token test1.c:1:4: warning: null character(s) ignored test1.c:1:6: warning: null character(s) ignored test1.c:1:7: error: stray '\207' in program test1.c:1:17: error: stray '\222' in program test1.c:1:19: error: stray '\372' in program test1.c:1:21: error: stray '\233' in program test1.c:1:25: error: stray '\213' in program test1.c:1:28: warning: null character(s) ignored test1.c:1:30: warning: null character(s) ignored test1.c:2:1: warning: null character(s) ignored # i n c l u d e < s t d i o . h > ^ test1.c:3:1: warning: null character(s) ignored i n t m a i n ( v o i d ) ^ test1.c:3:3: warning: null character(s) ignored i n t m a i n ( v o i d ) ^ test1.c:3:4: error: invalid preprocessing directive #i i n t m a i n ( v o i d ) ^ test1.c:3:5: warning: null character(s) ignored i n t m a i n ( v o i d ) ^ test1.c:3:7: warning: null character(s) ignored i n t m a i n ( v o i d ) ^ test1.c:3:9: warning: null character(s) ignored i n t m a i n ( v o i d ) ^ test1.c:3:11: warning: null character(s) ignored i n t m a i n ( v o i d ) ^ test1.c:3:13: warning: null character(s) ignored i n t m a i n ( v o i d ) ^ test1.c:3:15: warning: null character(s) ignored i n t m a i n ( v o i d ) ^ test1.c:3:17: warning: null character(s) ignored i n t m a i n ( v o i d ) ^ test1.c:3:21: warning: null character(s) ignored i n t m a i n ( v o i d ) ^ test1.c:3:23: warning: null character(s) ignored i n t m a i n ( v o i d ) ^ test1.c:3:25: warning: null character(s) ignored i n t m a i n ( v o i d ) ^ test1.c:3:27: warning: null character(s) ignored i n t m a i n ( v o i d ) ^ test1.c:3:29: warning: null character(s) ignored i n t m a i n ( v o i d ) ^ test1.c:3:31: warning: null character(s) ignored i n t m a i n ( v o i d ) ^ test1.c:3:33: warning: null character(s) ignored i n t m a i n ( v o i d ) ^ test1.c:3:35: warning: null character(s) ignored i n t m a i n ( v o i d ) ^ test1.c:3:37: warning: null character(s) ignored i n t m a i n ( v o i d ) ^ test1.c:4:1: warning: null character(s) ignored { ^ test1.c:5:1: warning: null character(s) ignored p r i n t f ( " % c o0アールW[g0Y00\ n " , ' A ' ) ; ^ test1.c:5:3: warning: null character(s) ignored p r i n t f ( " % c o0アールW[g0Y00\ n " , ' A ' ) ; ^ test1.c:5:5: warning: null character(s) ignored p r i n t f ( " % c o0アールW[g0Y00\ n " , ' A ' ) ; ^ test1.c:5:7: warning: null character(s) ignored p r i n t f ( " % c o0アールW[g0Y00\ n " , ' A ' ) ; ^ test1.c:5:11: warning: null character(s) ignored p r i n t f ( " % c o0アールW[g0Y00\ n " , ' A ' ) ; ^ test1.c:5:13: warning: null character(s) ignored p r i n t f ( " % c o0アールW[g0Y00\ n " , ' A ' ) ; ^ test1.c:5:15: warning: null character(s) ignored p r i n t f ( " % c o0アールW[g0Y00\ n " , ' A ' ) ; ^ test1.c:5:17: warning: null character(s) ignored 全部はコピーできませんでしたが、どうぞ、宜しくお願い申し上げます。

  • C言語がゎからなくて困ってます;;

    <プログラム(1)> #include <stdio.h> int main() { int i; char a[]="Simulation", *po; po=a; while(*po!='\0') { po++; i++; } printf("The Number of \"Simulation\" is %d\n", i); } <実行結果> The Number of "Simulation" is 10 <プログラム(2)> #include <stdio.h> int main() { int i,j = 0; char a[]="Faculty of Industrial Science and Technology", *po; po=a; while(*po!='\0') { if(*po <= 'z' && *po >= 'a') i++; if(*po <= 'Z' && *po >= 'A') j++; po++; } printf("\"Faculty of Industrial Science and Technology\" contains %d small letters.\n", i); printf("\"Faculty of Industrial Science and Technology\" contains %d capital letters.\n", j); } <実行結果> "Faculty of Industrial Science and Technology" contains 35 small letters. "Faculty of Industrial Science and Technology" contains 4 capital letters. 学校の宿題でプログラムを作ったんですけど、 プログラム(1)ではi=0と書ぃてぃないのにきちんと文字数のカウントが できるのに、プログラム(2)ではi,j=0と書かなければうまくいきませんでした。でもその理由がわからなくて困ってます↓↓ 誰か教えてくださぃ!! 教えてください。