0

I am trying to make a project I downloaded from github. After setting up all the dependencies, it asks me to run 'make'. However, 'make' fails and complains about chrono file not being found.
I understand that it is a compiler related issue and I have to enable c++11 support. More specifically, pass the compiler flag -stdlib=libc++.
However, adding this flag to my Makefile still produces the same error. Can anyone explain where/how this flag needs to be set?

this is the content of the Makefile:

TARGETS = \ 
    ptools \ 
    feature \ 
    libsvm \ 
    wrapper 

all: 
    -for dir in $(TARGETS); do \ 
    cd $${dir}; $(MAKE); cd ..; \ 
    done cd libsvm; $(MAKE) lib; cd ..; 

clean: 
    -for dir in $(TARGETS); do \ 
    cd $${dir}; $(MAKE) clean; cd ..; \ 
    done 

test: 
    @echo hello; 

.PHONY: clean $(TARGETS)

Update1: After running brew install gcc, it starts downloading the dependencies. However, it always breaks when it's downloading one of the dependencies, mpfr, with this error: Error: mpfr cannot be built with any available compilers. Install GNU's GCC.

Update2: I managed to update gcc and the version it returns is 6.2.0. However, I am still seeing the same error. I added CXXFLAGS += -stdlib=libc++ -std=gnu++11 to my Makefile, bust still see the same result.

Amin Abed
  • 33
  • 1
  • 6

1 Answers1

1

You should add

CXXFLAGS += -std=c++11

to your makefile (somewhere prior to the rules).


Supposed you have a up to date enough toolchain.

Older compilers support the flags

-std=c++0x

may be.


How to update your toolchain (as you asked for in your comment), depends on your OS environment and software managing system.

At least an option would be to compile the latest (stable) version of your toolchain yourself.

Community
  • 1
  • 1
πάντα ῥεῖ
  • 1
  • 13
  • 116
  • 190