ファイルが機能しないようにするc

ファイルが機能しないようにするc
A4: main.o testA4.o helper.o miscFunctions.o queueFunctions.o headerA4.h
    gcc -Wall -std=c99 main.o testA4.o helper.o miscFunctions.o queueFunctions.o

main.o: main.c headerA4.h
    gcc -Wall -std=c99 -c main.c -o main.o

testA4.o: testA4.c headerA4.h
    gcc -Wall -std=c99 -c testA4.c -o testA4.o

helper.o: helper.c headerA4.h
    gcc -Wall -std=c99 -c helper.c -o helper.o

miscFunctions.o: miscFunctions.c headerA4.h
    gcc -Wall -std=c99 -c miscFunctions.c -o miscFunctions.o

queueFunctions.o: queueFunctions.c headerA4.h
    gcc -Wall -std=c99 -c queueFunctions.c -o queueFunctions.o

clean:
    rm *.o

これは私のmakeファイルですが、コンパイルするとこれが起こります。

zali05@ginny:~/A4$ make
gcc -Wall -std=c99 main.o testA4.o helper.o miscFunctions.o queueFunctions.o
zali05@ginny:~/A4$ A4
bash: A4: command not found
zali05@ginny:~/A4$ A4:
bash: A4:: command not found
zali05@ginny:~/A4$ ./A4
bash: ./A4: No such file or directory
zali05@ginny:~/A4$ ./a.out
Begining A4 Program Testing...
Creating Initial List...
Enter a username:

それは適用されます./a.out

ベストアンサー1

link / loadコマンドにこのオプションはありません-o A4。これをで書くこともできます-o $@。同様に、コマンドでオブジェクトのリストをとして作成できます$^GNUが作る依存関係リストをコピーします。 (ああ、すべてのブランドはそうではありません。この機能.)

Makeはコンパイルモードも提供します。CFLAGSand(オプション)を設定CCし、すべてのコンパイルコマンドを省略できます。

また、ここに投稿するときにmakefileの最初の行形式を誤って指定しました。

完全な結果を提供するためにこのメイクファイルを作成し(使用せず)自動車メーカーまたは依存する(1つを使用します!)そしてターゲットはGNU固有のmakeではありません。次のように書くことができます。

A4_OBJS = main.o testA4.o helper.o miscFunctions.o queueFunctions.o 

CC = gcc
CFLAGS = -Wall -std=c99

A4 : ${A4_OBJS}
        ${CC} ${CFLAGS} ${LDFLAGS} -o $@ ${A4_OBJS}

main.o : main.c headerA4.h
testA4.o : testA4.c headerA4.h
helper.o : helper.c headerA4.h
miscFunctions.o : miscFunctions.c headerA4.h
queueFunctions.o : queueFunctions.c headerA4.h

clean :
        rm *.o A4

おすすめ記事