Reputation: 3263
I have some issues with my makefile. I have the following source codes: main.c cache.c cache.h When I run make it is what I get...
make
gcc −ansi −pedantic −Wall −m32 -c main.c
clang: error: no such file or directory: '−ansi'
clang: error: no such file or directory: '−pedantic'
clang: error: no such file or directory: '−Wall'
clang: error: no such file or directory: '−m32'
make: *** [main.o] Error 1
And here is my makefile:
COMPILER = gcc
CCFLAGS = −ansi −pedantic −Wall −m32
all: c-sim
c-sim: main.o cache.o
$(COMPILER) $(CCFLAGS) -o c-sim main.o cache.o
main.o: main.c
$(COMPILER) $(CCFLAGS) -c main.c
cache.o: cache.c
$(COMPILER) $(CCFLAGS) -c cache.c
clean:
rm -f c-sim
rm -f *.o
What can be the issue here?
Upvotes: 0
Views: 1584
Reputation: 241881
Don't write scripts with a word-processor.
The problem is that options start with a simple -. However, you've managed to enter typographical dashes. (Compare them with the - in -c
. Your – are slightly longer. Look closely.)
This might be because you incorrectly typed --
instead of -
. Gcc (and clang) allow but don't require long options (-pedantic and -ansi) to be specified with two dashes; that is the usual way of writing long options in other programs. Many word processors "correct" double dashes to an en-dash.
If you delete the en-dashes and replace them with simple single dashes, all will be well.
Upvotes: 4
Reputation: 7918
The Cause of the Problem is that you are not using GCC Compiler but using Clang compiler. In Clang flags are provided as :
/W0 /Wall
but GCC flags are provided as
-Wall -g
Thus you have change the flags according to Clang.
Upvotes: -2