c++プログラムのコンパイル方法がわからない

このQ&Aのポイント
  • 現在、ディレクトリの中には「rsa.cpp」というc++プログラムがありますが、そのコンパイル方法がわかりません。
  • 参考書には「makeを利用してコンパイルする」と書かれていますが、具体的な手順がわかりません。
  • どのようにすれば「rsa.cpp」をコンパイルできるのでしょうか?
回答を見る
  • ベストアンサー

makeでコンパイル

今、ディレクトリが以下の状態です。 [root@localhost rsa]#ls -l -rw-r--r--. 1 root root 2023 11月 27 21:24 2012 Makefile.am -rw-r--r--. 1 root root 16276 11月 27 21:24 2012 Makefile.in -rw-r--r--. 1 root root 2072 11月 27 21:24 2012 README -rw-r--r--. 1 root root 14137 11月 27 21:24 2012 rsa.cpp -rw-r--r--. 1 root root 4644 11月 27 21:24 2012 rsa.vcproj この状態で、c++プログラムである「rsa.cpp」をコンパイルしたいのですが、コンパイルの仕方がわかりません。参考書には「makeを利用してコンパイルする」としか書かれていません。どうしたらよいのでしょうか?

  • koun
  • お礼率37% (81/216)

質問者が選んだベストアンサー

  • ベストアンサー
  • notnot
  • ベストアンサー率47% (4848/10262)
回答No.1

普通は、READMEとか、INSTALLとかいう名前のファイルの中にコンパイル方法が書いてあります。 READMEがあるようなので、それを読んでください。

その他の回答 (1)

  • kmee
  • ベストアンサー率55% (1857/3366)
回答No.2

http://okwave.jp/qa/q7819074.html の#3にある通りで、 ./configure で Makefileが作られるはずです。

関連するQ&A

  • Makefile.inとMakefile.am

    回路設計をするためにsystemCをlinux(centOS)にインストールしました。サンプルプログラムの入ったディレクトリがあってそのサンプルプログラムをコンパイルして実行したいです。ところがコンパイルの仕方がわかりません。 例)rsaというディレクトリの内容 [root@localhost rsa]#ls -l -rw-r--r--. 1 root root 2023 11月 27 21:24 2012 Makefile.am -rw-r--r--. 1 root root 16276 11月 27 21:24 2012 Makefile.in -rw-r--r--. 1 root root 2072 11月 27 21:24 2012 README -rw-r--r--. 1 root root 14137 11月 27 21:24 2012 rsa.cpp -rw-r--r--. 1 root root 4644 11月 27 21:24 2012 rsa.vcproj 予想するに、systemCをインストールするときに $./configure $make $make install と打ったので、Makefile.inとMakefile.amがあやしいと思うのですが、これをどのように使ったらよいのやらわかりません。 教えてください。もしくは、参考文献などを教えてください。 すみません。

  • makeコマンドができない

    基本的なことだと思いますがお願いします。 fedore core で色んなことをやってみようと思い sl を インストール していたのですがmakeができないのです。インストール通りにできないの はなんでですか? makeコマンドは /usr/bin にありました。 的はずれなこと言っていたらすみません。 [root@localhost sl]# ls -lrt 合計 36 -rw-r--r-- 1 3605 lock 4101 1月 19 1994 sl.h -rw-r--r-- 1 3605 lock 980 1月 19 1994 sl.txt -rw-r--r-- 1 3605 lock 689 1月 19 1994 sl.1 -rw-r--r-- 1 3605 36 417 7月 22 1998 README -rw-r--r-- 1 3605 36 331 7月 22 1998 Makefile -rw-r--r-- 1 root root 76 10月 31 2005 install.txt -rw-r--r-- 1 3605 36 7131 10月 31 2005 sl.c [root@localhost sl]# more install.txt 1. # tar xvf sl.tar 2. # cd sl 3. # make 4. # cp sl /usr/local/bin/ 5. # sl [root@localhost sl]# make cc -O -o sl sl.c -lcurses -ltermcap make: cc: コマンドが見つかりませんでした make: *** [sl] エラー 127

  • ls -lの見方を教えてください。

    ls -lのパーミッションの次にでてくる数字はファイルとディレクトリの場合で何を表すか教えてください。 [root@hogehoge etc]# ls -l /etc/sysconfig/networking/profiles/default/ 合計 36 -rw-r--r-- 2 root root 146 8月 25 23:12 hosts -rw-r--r-- 3 root root 221 8月 25 23:12 ifcfg-eth0 -rw-r--r-- 3 root root 147 8月 25 23:12 ifcfg-eth1 -rw-r--r-- 1 root root 0 8月 25 23:12 network -rw-r--r-- 2 root root 80 8月 25 23:12 resolv.conf

  • chmod ファイル属性について教えてください

    あるディレクトリーで ls -al を行ったところ -rw-r--r--+ 1 root root 34759 3月 7 06:17 2012 httpd.conf と言った表示見つけました。 上記の場合だと、chmod 644 だとは思うのですが、最後の+は、何を意味しているのでしょうか? 気になって他のディレクトリーも見てみると -rw-r--r--@ 1 root root 34759 3月 7 06:17 2012 **** みたいな、@という表記もありました。 ファイル属性の何かだとは思うのですが、分かる方が居られましたらご教授頂けないでしょうか? よろしくお願いいたします

  • スペシャルファイルのグループについて

    スペシャルファイルをlsで見た際、グループ名にカンマが含まれています。(disk 3, 0) /etc/groupファイルを見てもdiskというグループはあるがdisk 3, 0というグループはありません。 これはいったい何を意味しているのでしょうか? <例:スペシャルファイルのls> [root@localhost test]# ls -l /dev/hda brw-rw---- 1 root disk 3, 0 Oct 14 15:21 /dev/hda <例:通常ファイルのls> [root@localhost test]# ls -l ./sc -rw-r--r-- 1 hoge hoge4 34 Oct 9 17:28 ./sc

  • CentOSにRTL8111Cインストールできない

    CentOSをインストールしましたがNICを検出しません。 調査しRTL8111Cであることが分かり、ReadMeに書かれているように 以下の手順を試みましたが、組み込めません。 どなたか対策方法がお分かりになる方教えて下さい。 尚、PCはPCIBusを持っていませんので、別売りの100BASENICに換え ることもできません。初心者で手順が悪いのかよく分かりません。 (1)Realtekからドライバの入手   r8168-8.008.00tar.bz2 (2)ドライバのコピー先を”/root/DownLoad”作成 (3)ドライバをこのフォルダーに入れダブルクリック(解凍) (4)"r8168-8.008.00"が作られ中に以下のフォルダとファイルが生成される  src  Makefile  readme  release_note.txt (5)GNOME端末で # cd Download # cd r8186-8.008.00  # make clean modules (6)表示 [root@localhost Download]# cd r8168-8.008.00 [root@localhost r8168-8.008.00]# make clean modules make -C src/ clean make[1]: ディレクトリ `/root/Download/r8168-8.008.00/src' に入ります rm -rf *.o *.ko *~ core* .dep* .*.d .*.cmd *.mod.c *.a *.s .*.flags .tmp_versions Module.symvers Modules.symvers *.order make[1]: ディレクトリ `/root/Download/r8168-8.008.00/src' から出ます make -C src/ modules make[1]: ディレクトリ `/root/Download/r8168-8.008.00/src' に入ります make -C /lib/modules/2.6.18-8.el5/build SUBDIRS=/root/Download/r8168-8.008.00/src modules make: Entering an unknown directory make: *** /lib/modules/2.6.18-8.el5/build: そのようなファイルやディレクトリはありません. 中止. make: Leaving an unknown directory make[1]: *** [modules] エラー 2 make[1]: ディレクトリ `/root/Download/r8168-8.008.00/src' から出ます make: *** [modules] エラー 2 [root@localhost r8168-8.008.00]# 宜しくお願いします

  • Solaris10のホスト名の変更

    こんにちは。 8年振りにSolarisをさわっています。 Solaris10のホスト名の変更を行いたいのですが、Solaris9のテキストに6つのファイルをすべて変更する必要があると書いてありました。これはSolaris10でもそうなのでしょうか。確認したところ、/etc/nodenameというファイルはありませんでした。現在DHCP接続にしているのですが、それでもホスト名の変更は行えますか。 ご回答お待ちしております。 bash-3.2# ls -la /etc/nodename /etc/nodename: No such file or directory bash-3.2# ls -la /etc/hostname* -rw-r--r-- 1 root root 1 Dec 27 11:42 /etc/hostname.e1000g0 bash-3.2# ls -la /etc/inet/hosts -r--r--r-- 1 root root 101 Dec 27 11:49 /etc/inet/hosts bash-3.2# ls -la /etc/net/ticlts/hosts -rw-r--r-- 1 root sys 239 Jan 22 2005 /etc/net/ticlts/hosts bash-3.2# ls -la /etc/net/ticots/hosts -rw-r--r-- 1 root sys 239 Jan 22 2005 /etc/net/ticots/hosts bash-3.2# ls -la /etc/net/ticotsord/hosts -rw-r--r-- 1 root sys 239 Jan 22 2005 /etc/net/ticotsord/hosts bash-3.2# cat /etc/inet/hosts # # Internet host table # ::1 localhost 127.0.0.1 localhost 192.168.236.129 unknown # Added by DHCP bash-3.2#

  • makeによるソースのコンパイル方法について

    RS485の規格で、動作する、USBとRJ45を接続するケーブルを使用したいと考えています。 Linux(Raspberrypi(debian_version9.1))で作動をさせたいのですが、ドライバーが、 https://www.exar.com/design-tools/software-drivers のサイトにある、 Product Family /USB UART Part Number(s)/XR21V1410, XR21V1412, XR21V1414, XR21B1411, XR21B1420, XR21B1422, XR21B1424, XR22801, XR22802, XR22804 Operating System/Linux 3.6.x and newer Driver Version/1B を、ダウンロードすると、 xr_usb_serial_common_lnx-3.6-and-newer-pak.zip  Makefile  README.txt  xr_usb_serial_common.c  xr_usb_serial_common.h  xr_usb_serial_hal.c  xr_usb_serial_ioctl.h というファイルが入っていました。 README.txtを見て、 --------------------------------------------------------------------------- Installation ------------ * Compile and install the common usb serial driver module # make # insmod ./xr_usb_serial_common.ko --------------------------------------------------------------------------- 「make」というコマンドを実行しているのですが、 --------------------------------------------------------------------------- make -C /lib/modules/4.9.59-v7+/build M=/lib/modules/4.9.59-v7+/build make[12]: ディレクトリ '/lib/modules/4.9.59-v7+/build' に入ります --------------------------------------------------------------------------- を繰り返し表示し、 CTRL+Cを押して止めようとすると、 --------------------------------------------------------------------------- makefile:9: ターゲット 'all' のレシピで失敗しました make[11]: *** [all] 割り込み makefile:9: ターゲット 'all' のレシピで失敗しました --------------------------------------------------------------------------- のようなものを繰り返し表示します。  Linuxのコマンドはある程度わかりますが、添付されているCのファイルをコンパイル して、ドライバーをつくるんだろうくらいしかわからない初心者です。  このmakeはどうやったらRaspberryPiで正常にコンパイルができるようになるのでしょうか。  具体的なやり方を、教えていただけないでしょうか。

  • " ls -l " から、指定縦列の中から、grepする方法

    SunOS 5.8 sun4u sparc UltraAX-i2 > ls -l -rw-r--r-- 1 root other 100 1月 1日 00:00 abc-1.txt -rw-r--r-- 1 root other 100 1月 1日 00:00 abc-2.txt -rw-r--r-- 1 root other 100 1月 1日 00:00 abc-3.txt -rw-r--r-- 1 root other 100 5月 11日 00:00 abc-11.txt -rw-r--r-- 1 root other 100 1月 12日 00:00 abc-12.txt -rw-r--r-- 1 root other 100 1月 13日 00:00 abc-13.txt -rw-r--r-- 1 root other 100 1月 1日 00:00 abc-5.txt -rw-r--r-- 1 root other 100 5月 1日 00:00 abc-6.txt -rw-r--r-- 1 root other 100 1月 1日 00:00 abc-7.txt -rw-r--r-- 1 root other 100 1月 1日 00:00 abc-51.txt -rw-r--r-- 1 root other 100 1月 1日 00:00 abc-61.txt -rw-r--r-- 1 root other 100 5月 1日 00:00 abc-71.txt ここから、" 5月 " のファイルのみを標準出力したいのですが、 日本語環境の不備から " ls -l | grep 5月 " のコマンドは刎ねられます。 ですので、策としては、以下のように ls -l ↓ 6列目(月列)を指定。 ↓ 5 を grep しなさい。 このように(sort +5)のような感じで、パイプをつなげたようなコマンドを用意したいのですが、 その機能が見つかりません。詳しい方、教えて下さい。 csh (bash使用可能) egrep,fgrep使用可能

  • .cppファイルのコンパイルについて

    初心者ですがお願いします。 Sample.cppを改造しています。 コンパイルするに当たりコマンドプロンプトを利用しています。 c:\cwork>cl sample.cpp Microsoft(R) 32-bit C/C++ Optimizing Compiler Version 14.0050727.42 for 80x86 Copyright (C) Microsoft Corporation. All rights reserved. sample.cpp c:\cwork\comm.h(24) : fatal error C1083:include ファイルを開け ません。'windows.h':No such file or directory ファイルを開けません。'windows.h' を解消するにはどうすれば良いでしょうか

専門家に質問してみよう