I'm trying to understand MakeFiles and I'm trying to set the CFLAGS to C++11 in my make file. I have read the following: Makefile modification to support c++11 I have implemented one of the solutions, however, it does not seem to work, I'm getting the same error:
error: 'i' does not name a type for(auto i=begin; (i != end); i++)
Here is my MakeFile:
# Location of the Python Header files
# This is system dependant.
PYTHON_VERSION = 2.7
PYTHON_INCLUDE = /usr/include/python$(PYTHON_VERSION)
CFLAGS += -03
CFLAGS += -std=c++0x
CFLAGS += -pg -D_DEBUG -g -c -Wal
# location of the Boost Python include files and library
BOOST_INC = /usr/include
BOOST_LIB = /usr/lib
WAV_TARGET = /includes/Wav
WAV_SOURCE = Wav
# Compile the .wav Python and Cpp file
$(WAV_TARGET).so: $(WAV_TARGET).o
g++ -shared -Wl, --export-dynamic ($WAV_TARGET).o -L$(BOOST_LIB) -lboost_python -
L/usr/lib/python$(PYTHON_VERSION)/config -lpython$(PYTHON_VERSION) -o
$(WAV_TARGET).so
$(WAV_TARGET).o: $(WAV_SOURCE).cpp
g++ -I$(PYTHON_INCLUDE) -I$(BOOST_INC) -fPIC -c Wav.cpp
I'm probably missing something really stupid, but where am I going wrong here?
Your target isn't even using CFLAGS
when invoking g++
. You can either add $(CFLAGS)
to the target:
$(WAV_TARGET).o: $(WAV_SOURCE).cpp
g++ $(CFLAGS) -I$(PYTHON_INCLUDE) -I$(BOOST_INC) -fPIC -c Wav.cpp
Or just add -std=c++11
to the flags you listed:
$(WAV_TARGET).o: $(WAV_SOURCE).cpp
g++ -std=c++11 -I$(PYTHON_INCLUDE) -I$(BOOST_INC) -fPIC -c Wav.cpp
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.