2017-12-20 5 views
1
      $project 
          | 
    +------------+----------------+----------------+ 
    |   |    |    | 
    gestore/  tipoA/   tipoB/   shared/ 
    |   |    |     | 
    +   +    +     + 
    |   |    |  +--------|------------------+ 
    gestore.c  tipoA.c   tipoB.c/ funzioni.c/.h sem.c/.h gF.c./ 

こんにちはを反復処理メイクファイルを作成し、私はこれらのコマンドを実行し、このプロジェクトのためのメイクファイルを作成したいですtipoA FOLDER:tipoBフォルダにディレクトリ

gcc -o tipoA tipoA.c ../shared/funzioni ../shared/sem ../shared/gestioneFile 

ステップ3:

gestoreフォルダに
gcc -o tipoB tipoB.c ../shared/funzioni ../shared/sem ../shared/gestioneFile 

ステップ4:

gcc -o gestore gestore.c ../shared/funzioni ../shared/sem ../shared/gestioneFile 

./gestore 

これは私のメイクですが、それがない作品行います

#Makefile 

cc=gcc 

./gestore/gestore: ./shared/gestioneFile.o ./shared/sem.o ./shared/funzioni.o ./tipoA/tipoA.o ./tipoB/tipoB.o ./gestore/gestore.o 
    ./gestore/gestore 

./shared/gestioneFile.o: 
    cc -c -o ./shared/gestioneFile ./shared/gestioneFile.c 

./shared/sem.o: 
    cc -c -o ./shared/sem ./shared/sem.c 

./shared/functions.o: 
    cc -c -o ./shared/funzioni ./shared/funzioni.c 

./tipoA/tipoA.o: ./shared/gestioneFile.o ./shared/sem.o ./shared/funzioni.o 
    cc -o ./tipoA/tipoA ./tipoA/tipoA.c ./shared/funzioni ./shared/sem ./shared/gestioneFile 

./tipoB/tipoB.o: ./shared/gestioneFile.o ./shared/sem.o ./shared/funzioni.o 
    cc -o ./tipoB/tipoB ./tipoB/tipoB.c ../shared/funzioni ../shared/sem ../shared/gestioneFile 

./gestore/gestore.o: ./shared/gestioneFile.o ./shared/sem.o ./shared/funzioni.o 
    cc -o ./gestore/gestore ./gestore/gestore.c ./shared/funzioni ./shared/sem ./shared/gestioneFile 

EDIT: @HardcoreHenryこれが今の私のメイクですが、それが与えるをエラー:*****見つからないセパレータ**

#Makefile 

cc=gcc 

./gestore/gestore: ./shared/gestioneFile.o ./shared/sem.o ./shared/funzioni.o ./tipoA/tipoA.o ./tipoB/tipoB.o ./gestore/gestore.o 
    ./gestore/gestore 

./shared/gestioneFile.o: 
    cc -c -o ./shared/gestioneFile.o ./shared/gestioneFile.c 

./shared/sem.o: 
    cc -c -o ./shared/sem.o ./shared/sem.c 

./shared/funzioni.o: 
    cc -c -o ./shared/funzioni.o ./shared/funzioni.c 

./tipoA/tipoA.o: ./shared/gestioneFile.o ./shared/sem.o ./shared/funzioni.o 
    cc -o ./tipoA/tipoA.o ./tipoA/tipoA.c ./shared/funzioni.o ./shared/sem.o ./shared/gestioneFile.o 

./tipoB/tipoB.o: ./shared/gestioneFile.o ./shared/sem.o ./shared/funzioni.o 
    cc -o ./tipoB/tipoB.o ./tipoB/tipoB.c ../shared/funzioni.o ../shared/sem.o ../shared/gestioneFile.o 

./gestore/gestore.o: ./shared/gestioneFile.o ./shared/sem.o ./shared/funzioni.o 
    cc -o ./gestore/gestore.o ./gestore/gestore.c ./shared/funzioni.o ./shared/sem.o ./shared/gestioneFile.o 

SOLVED(たとえE最初のルールは)ファイルを実行しません:

./gestore/gestore: ./shared/gestioneFile.o ./shared/sem.o ./shared/funzioni.o ./tipoA/tipoA ./tipoB/tipoB ./gestore/gestore 
    ./gestore/gestore 

./shared/gestioneFile.o: 
    gcc -c -o ./shared/gestioneFile ./shared/gestioneFile.c 

./shared/sem.o: 
    gcc -c -o ./shared/sem ./shared/sem.c 

./shared/funzioni.o: 
    gcc -c -o ./shared/funzioni ./shared/funzioni.c 

./tipoA/tipoA: ./shared/gestioneFile.o ./shared/sem.o ./shared/funzioni.o 
    gcc -o ./tipoA/tipoA ./tipoA/tipoA.c ./shared/gestioneFile ./shared/sem ./shared/funzioni 

./tipoB/tipoB: ./shared/gestioneFile.o ./shared/sem.o ./shared/funzioni.o 
    gcc -o ./tipoB/tipoB ./tipoB/tipoB.c ./shared/gestioneFile ./shared/sem ./shared/funzioni 

./gestore/gestore: ./shared/gestioneFile.o ./shared/sem.o ./shared/funzioni.o 
    gcc -o ./gestore/gestore ./gestore/gestore.c ./shared/gestioneFile ./shared/sem ./shared/funzioni 
+3

。あなたの質問の最も重要かつ重要な部分 - どのようにMakefileが機能しないのですか?詳細を与える! –

+1

この行( 'cc = gcc')は途中で何もしません。おそらく 'CC = gcc'を意味するかもしれませんが、他の場所で' cc'ではなく '$(CC)'を使用していたでしょう –

+2

'-o 'オプションの拡張子がないようです: ' cc - c -o ./shared/sem。/ shared/sem.c'は 'cc -c -o ./shared/sem.o。/ shared/sem.c'になります。 – Nonyme

答えて

1

次の行はあなたにこれらのエラーを与える:

./tipoA/tipoA.o: ./shared/gestioneFile.o ./shared/sem.o ./shared/funzioni.o 
    cc -o ./tipoA/tipoA ./tipoA/tipoA.c ./shared/funzioni ./shared/sem ./shared/gestioneFile 

まず、@Nonymeが指摘したように、あなたは./tipoA/tipoA代わりの./tipoA/tipoA.oに出力しています。しかし、これはあなたのコンパイルの失敗を引き起こすことはありません。

エラーが発生する原因は、./shared/funzioniを入力として使用しようとしていることです。そのファイルは存在しません。 (あなたはあなたのCCのターゲットとソースに.o年代を追加する必要があります).oなし(メイクファイルのターゲットはこのレシピが呼び出される前に構築する必要がある、./shared/funzioni.oに依存しますが、それはshared/funzioniを生成しません

に気付きます私も$(CC)を使用することをお勧めしコマンド

、ルックアップautomatic variables - 。。あなたのレシピのために、具体的[email protected]$^は多くのすっきりとエラーが発生しにくいあなたは出て残してきたような方法

./tipoA/tipoA.o: ./shared/gestioneFile.o ./shared/sem.o ./shared/funzioni.o 
    $(CC) -o [email protected] $^ 
+0

質問を編集しました。 –

+0

私は、タブの代わりにレシピの前にスペースを入れるとエラーが出力されると思います。 – HardcoreHenry

+0

このエラー – HardcoreHenry

関連する問題