mercredi 15 septembre 2021

compiling c++11 using make command

I am trying to compile my code on CPU using MobaXterm terminal and I use make command to compile my code. But many errors appears starting with the ones bellow. I searched online and understand that this is an issue with the compiler. But I am using make not g++. Any suggestion to solve these compilation problems.

In file included from /usr/include/c++/4.8.2/array:35:0,
                     from host/src/host.cpp:16:
    /usr/include/c++/4.8.2/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
     #error This file requires compiler and library support for the \
      ^
    host/src/host.cpp:24:37: error: ‘array’ has not been declared
     bool read_data_set(string filename, array<array<int, 20>, 5430>& array_X_dataset, array<int, 5430>& array_Y_dataset) {
                                         ^
    host/src/host.cpp:24:42: error: expected ‘,’ or ‘...’ before ‘<’ token
     bool read_data_set(string filename, array<array<int, 20>, 5430>& array_X_dataset, array<int, 5430>& array_Y_dataset) {
                                              ^
    host/src/host.cpp: In function ‘bool read_data_set(std::string, int)’:
    host/src/host.cpp:31:29: error: no matching function for call to ‘std::basic_ifstream<char>::basic_ifstream(std::string&)’
         ifstream myfile(filename);

Makefile:

    ifeq ($(VERBOSE),1)
ECHO :=
else
ECHO := @
endif

# Where is the Intel(R) FPGA SDK for OpenCL(TM) software?
ifeq ($(wildcard $(INTELFPGAOCLSDKROOT)),)
$(error Set INTELFPGAOCLSDKROOT to the root directory of the Intel(R) FPGA SDK for OpenCL(TM) software installation)
endif
ifeq ($(wildcard $(INTELFPGAOCLSDKROOT)/host/include/CL/opencl.h),)
$(error Set INTELFPGAOCLSDKROOT to the root directory of the Intel(R) FPGA SDK for OpenCL(TM) software installation.)
endif

# OpenCL compile and link flags.
AOCL_COMPILE_CONFIG := $(shell aocl compile-config )
AOCL_LINK_CONFIG := $(shell aocl link-config )

# Compilation flags
ifeq ($(DEBUG),1)
CXXFLAGS += -g
else
CXXFLAGS += -O2
endif

# Compiler
CXX := g++

# Target
TARGET := host
TARGET_DIR := bin

# Directories
INC_DIRS := ../common/inc
LIB_DIRS :=

# Files
INCS := $(wildcard )
SRCS := $(wildcard host/src/*.cpp ../common/src/AOCLUtils/*.cpp)
LIBS := rt pthread

# Make it all!
all : $(TARGET_DIR)/$(TARGET)

# Host executable target.
$(TARGET_DIR)/$(TARGET) : Makefile $(SRCS) $(INCS) $(TARGET_DIR)
        $(ECHO)$(CXX) $(CPPFLAGS) $(CXXFLAGS) -fPIC $(foreach D,$(INC_DIRS),-I$D) \
                        $(AOCL_COMPILE_CONFIG) $(SRCS) $(AOCL_LINK_CONFIG) \
                        $(foreach D,$(LIB_DIRS),-L$D) \
                        $(foreach L,$(LIBS),-l$L) \
                        -o $(TARGET_DIR)/$(TARGET)

$(TARGET_DIR) :
        $(ECHO)mkdir $(TARGET_DIR)

# Standard make targets
clean :
        $(ECHO)rm -f $(TARGET_DIR)/$(TARGET)

.PHONY : all clean
  

       
                                 ^

Aucun commentaire:

Enregistrer un commentaire