makefile - C++ File Requires Library Support -
i'm trying compile simple program terminal utilizes condition_variable class. upon building, following error:
this file requires compiler , library support iso c++ 2011 standard. support experimental, , must enabled
-std=c++11
or-std=gnu++11
compiler options.
in researching error here, added necessary flag make file, i'm still getting same error.
here makefile:
cxx= g++ $(ccflags) main= main.o dataclass= dataclass.o objs = $(main) $(dataclass) libs= -pthread ccflags= -g -std=c++11 all: main main: $(main) $(dataclass) $(cxx) -o main $(main) $(dataclass) $(libs) dataclass: $(dataclass) $(cxx) -o dataclass $(dataclass) $(libs) clean: rm -f $(objs) $(objs:.o=.d) realclean: rm -f $(objs) $(objs:.o=.d) main %.d: %.cc $(shell) -ec '$(cc) -m $(cppflags) $< \ | sed '\''s/\($*\)\.o[ :]*/\1.o $@ : /g'\'' > $@; \ [ -s $@ ] || rm -f $@' include $(objs:.o=.d)
i'm sure i'm missing small , stupid i'm new makefiles, appreciated.
- rewrite
cxx
cxx = g++
- change
ccflags
cxxflags = -g -std=c++11
, and - rewrite rules
$(cxx) $(cxxflags) ...
.
$(cxx) $(cxxflags)
replaced g++ -g -std=c++11
. more of standard method defining makefile
. here snippet of resulting makefile
.
cxx = g++ main = main.o dataclass = dataclass.o objs = $(main) $(dataclass) libs = -pthread cxxflags = -g -std=c++11 all: main main: $(objs) $(cxx) $(cxxflags) $? -o $@ $(libs)
as side note, sure rule should defined such?
dataclass: $(dataclass) $(cxx) $(cxxflags) $? -o $@ $(libs)
should target not dataclass.o
or $(dataclass)
, prerequisite other file?
note: i've included make
automatic variables tidy makefile
rules.
$?
- replaced prerequisites$@
- replaced target name
Comments
Post a Comment