Path: ccsf.homeunix.org!ccsf.homeunix.org!news1.wakwak.com!nf1.xephion.ne.jp!onion.ish.org!onodera-news!newsfeed.media.kyoto-u.ac.jp!np0.iij.ad.jp!news.iij.ad.jp!yilnws!relay-yamaha-to-plala!news.plala.or.jp!not-for-mail From: "Yoshihiro Tabuchi" Newsgroups: fj.os.bsd.freebsd Subject: =?iso-2022-jp?B?UmU6IEZyZWVCU0QgNS4yGyRCJE4bKEJDGyRCJTMlcyVRJSQbKEI=?= =?iso-2022-jp?B?GyRCJWkkRyEiGyhCc3RkaW8bJEI0WE8iJE40WD90JCwlaiVzJS8bKEI=?= =?iso-2022-jp?B?GyRCJEckLSRKJCQbKEI=?= Date: Thu, 8 Jan 2004 18:58:32 +0900 Organization: PLALA Lines: 65 Message-ID: References: <87isjnp01h.fsf@boggy.acest.tutrp.tut.ac.jp> NNTP-Posting-Host: s197227.ap.plala.or.jp Mime-Version: 1.0 Content-Type: text/plain; charset="iso-2022-jp" Content-Transfer-Encoding: 7bit X-Trace: pin3.tky.plala.or.jp 1073555897 26350 220.109.197.227 (8 Jan 2004 09:58:17 GMT) X-Complaints-To: abuse@plala.or.jp NNTP-Posting-Date: 8 Jan 2004 09:58:17 GMT X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Xref: ccsf.homeunix.org fj.os.bsd.freebsd:144  中治様。早速の回答ありがとうございました。 > > ファイル名が .cpp で終わっているので、C++ のプログラムだとコンパイラが判断 > するからです。 > > FreeBSD 附属の cc の実体は gcc ですが、その info によると、 > > Options Controlling the Kind of Output > ====================================== > > Compilation can involve up to four stages: preprocessing, compilation > proper, assembly and linking, always in that order. The first three > stages apply to an individual source file, and end by producing an > object file; linking combines all the object files (those newly > compiled, and those specified as input) into an executable file. > > For any given input file, the file name suffix determines what kind > of compilation is done: > > ... > > `FILE.cc' > `FILE.cxx' > `FILE.cpp' ←これ > `FILE.C' > C++ source code which must be preprocessed. Note that in `.cxx', > the last two letters must both be literally `x'. Likewise, `.C' > refers to a literal capital C. > > ですから、ファイル名を temp.c に変更するとうまくいくはずです。 > --  なるほど...確かに.cに変えれば動きますね...  ただ、実際に5.2に移植したいプログラムは、クラスを使った上に内部でsprintfを 使って文字列の設定をやっているプログラムなので、単純に拡張子(UNIXでこう呼ん でいいのかな?)を変えるわけには行きません。  例えば、下のようなコードを正常に動かしたければどうすればよいでしょうか? #include class Printer { public: void out(){printf( "hello!" ); } }; main() { Printer p; p.out(); return 1; }  FreeBSD4.7でやったときには普通にリンクまで出来ていたのですが...誠に申し 訳ありませんが、よろしくお願いいたします。  ************************************** *** 田淵義弘 in SPOONsoftware *** E-Mail : tabuchi@spoonsoftware.com *** HP : http://www.spoonsoftware.com **************************************