samedi 24 février 2018

#error This file requires compiler and library support for the ISO C++ 2011 standard

I'm in Ubuntu 16.04.3 LTS xenial and I'm trying to run the command make on the terminal, but I'm getting this error:

g++ -g -O2 -Wall -Wuninitialized -fno-strict-aliasing -Iinclude -
I/usr/local/include -DOS_LINUX -DHAVE_USB -DHAVE_LIBUSB10 -
DUSE_DRS_MUTEX -I/usr/lib/x86_64-linux-gnu/wx/include/gtk3-unicode-
3.1-unofficial3 -I/usr/include/wx-3.1-unofficial -
D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread -c src/DRS.cpp
In file included from /usr/include/c++/5/type_traits:35:0,
                 from /usr/include/wx-3.1-unofficial/wx/strvararg.h:22,
                 from /usr/include/wx-3.1-unofficial/wx/string.h:37,
                 from /usr/include/wx-3.1-unofficial/wx/memory.h:15,
                 from /usr/include/wx-3.1-unofficial/wx/object.h:19,
                 from /usr/include/wx-3.1-unofficial/wx/wx.h:15,
                 from src/DRS.cpp:15:
/usr/include/c++/5/bits/c++0x_warning.h:32:2: error: #error This file 
requires compiler and library support for the ISO C++ 2011 standard. 
This support must be enabled with the -std=c++11 or -std=gnu++11 c 
ompiler options.
#error This file requires compiler and library support \
  ^
In file included from /usr/include/wx-3.1-unofficial/wx/string.h:37:0,
                 from /usr/include/wx-3.1-unofficial/wx/memory.h:15,
                 from /usr/include/wx-3.1-unofficial/wx/object.h:19,
                 from /usr/include/wx-3.1-unofficial/wx/wx.h:15,
                 from src/DRS.cpp:15:
/usr/include/wx-3.1-unofficial/wx/strvararg.h:345:18: error: ‘is_enum’ 
in namespace ‘std’ does not name a template type
     typedef std::is_enum<T> is_enum;
                  ^
/usr/include/wx-3.1-unofficial/wx/strvararg.h:349:54: error: ‘is_enum’ 
was not declared in this scope
     enum { value = 
wxFormatStringSpecifierNonPodType<is_enum::value>::value };
                                                  ^
/usr/include/wx-3.1-unofficial/wx/strvararg.h:349:68: error: template 
argument 1 is invalid
     enum { value = 
wxFormatStringSpecifierNonPodType<is_enum::value>::value };
                                                                ^
src/DRS.cpp: In member function ‘void DRSBoard::InteractSpeed()’:
src/DRS.cpp:3986:25: warning: ignoring return value of ‘int 
scanf(const char*, ...)’, declared with attribute warn_unused_result 
[-Wunused-result]
       scanf("%lf", &vds);
                     ^
Makefile:81: recipe for target 'DRS.o' failed
make: *** [DRS.o] Error 1

I think that I must do this correction:

This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.

I have never tried to do something like this before, so I don't know how to correct.

Follows the makefile:

# check if wxWidgets is installed
HAVE_WX       = $(shell which wx-config)
ifeq ($(HAVE_WX),)
$(error Error: wxWidgets required to compile "drsosc")
endif

# check for OS
OS            = $(shell uname)
ifeq ($(OS),Darwin)
DOS           = OS_DARWIN
else
DOS           = OS_LINUX
endif

CFLAGS        = -g -O2 -Wall -Wuninitialized -fno-strict-aliasing -
Iinclude -I/usr/local/include -D$(DOS) -DHAVE_USB -DHAVE_LIBUSB10 -
DUSE_DRS_MUTEX
LIBS          = -lpthread -lutil -lusb-1.0

ifeq ($(OS),Darwin)
CFLAGS        += -stdlib=libstdc++
endif         

# wxWidgets libs and flags
WXLIBS        = $(shell wx-config --libs)
WXFLAGS       = $(shell wx-config --cxxflags)

CPP_OBJ       = DRS.o averager.o ConfigDialog.o DOFrame.o DOScreen.o 
DRSOsc.o MeasureDialog.o Measurement.o Osci.o InfoDialog.o 
DisplayDialog.o AboutDialog.o EPThread.o TriggerDialog.o rb.o
OBJECTS       = musbstd.o mxml.o strlcpy.o


ifeq ($(OS),Darwin)
all: drsosc drscl drs_exam drs_exam_multi DRSOsc.app
else
all: drsosc drscl drs_exam drs_exam_multi
endif

DRSOsc.app: drsosc
    -mkdir DRSOsc.app
    -mkdir DRSOsc.app/Contents
    -mkdir DRSOsc.app/Contents/MacOS
    -mkdir DRSOsc.app/Contents/Resources
    -mkdir DRSOsc.app/Contents/Resources/English.lproj
    echo 'APPL????' > DRSOsc.app/Contents/PkgInfo
    cp Info.plist DRSOsc.app/Contents/Info.plist
    cp DRSOsc.icns DRSOsc.app/Contents/Resources
    cp drsosc DRSOsc.app/Contents/MacOS/DRSOsc

drsosc: $(OBJECTS) $(CPP_OBJ) main.o
    $(CXX) $(CFLAGS) $(OBJECTS) $(CPP_OBJ) main.o -o drsosc $(LIBS) 
$(WXLIBS)

drscl: $(OBJECTS) DRS.o averager.o drscl.o
    $(CXX) $(CFLAGS) $(OBJECTS) DRS.o averager.o drscl.o -o drscl 
$(LIBS) $(WXLIBS)

drs_exam: $(OBJECTS) DRS.o averager.o drs_exam.o
$(CXX) $(CFLAGS) $(OBJECTS) DRS.o averager.o drs_exam.o -o drs_exam 
$(LIBS) $(WXLIBS)

drs_exam_multi: $(OBJECTS) DRS.o averager.o drs_exam_multi.o
    $(CXX) $(CFLAGS) $(OBJECTS) DRS.o averager.o drs_exam_multi.o -o 
drs_exam_multi $(LIBS) $(WXLIBS)

main.o: src/main.cpp include/mxml.h include/DRS.h
    $(CXX) $(CFLAGS) $(WXFLAGS) -c $<

drscl.o: src/drscl.cpp include/mxml.h include/DRS.h
    $(CXX) $(CFLAGS) -c $<

drs_exam.o: src/drs_exam.cpp include/mxml.h include/DRS.h
    $(CXX) $(CFLAGS) -c $<

drs_exam_multi.o: src/drs_exam_multi.cpp include/mxml.h include/DRS.h
    $(CXX) $(CFLAGS) -c $<

$(CPP_OBJ): %.o: src/%.cpp include/%.h include/mxml.h include/DRS.h
    $(CXX) $(CFLAGS) $(WXFLAGS) -c $<

$(OBJECTS): %.o: src/%.c include/mxml.h include/DRS.h
    $(CC) $(CFLAGS) -c $<

clean:
    rm -f *.o drscl drsosc

In my research I didn't find anything helpful. Sorry for the long post, couldn't make it more simple.

Aucun commentaire:

Enregistrer un commentaire