I have a Makefile for this game I'm making. It looks like this.
我有这个游戏的Makefile我正在制作。看起来像这样。
CC = g++
CFLAGS = -std=c++11 -w
game: main.o item.o game.o player.o map.o room.o menu.o notebook.o enemy.o
$(CC) $(CFLAGS) -o game main.o item.o game.o player.o map.o room.o menu.o notebook.o enemy.o
mv game ../
I am using the -std=c++11
line in the CFLAGS
line, however, when I run make
, I am told that I need to use C++11 since I am using the #include <random>
line in one of my files. I hadn't noticed the compilation wasn't always using the CFLAGS line when compiling until this.
我在CFLAGS行中使用-std = c ++ 11行,但是,当我运行make时,我被告知我需要使用C ++ 11,因为我在其中一个中使用#include
What do I need to do in order to make the automatic compilation of the object files use the CFLAGS
also?
为了使目标文件的自动编译还需要使用CFLAGS,我需要做什么?
1 个解决方案
#1
0
Specify how to generate your .o files:
指定如何生成.o文件:
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
As @juanchopanza mentions, you should really be using CXX
and CXXFLAGS
.
正如@juanchopanza所提到的,你应该真正使用CXX和CXXFLAGS。
#1
0
Specify how to generate your .o files:
指定如何生成.o文件:
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
As @juanchopanza mentions, you should really be using CXX
and CXXFLAGS
.
正如@juanchopanza所提到的,你应该真正使用CXX和CXXFLAGS。