Search code examples
c++xcodemacosmacos-high-sierra

Mac OS High Sierra: OS upgrade fails make in C++


I could successfully make before I installed the High sierra Update 10.13.1 My make file has following configs:

CC = g++-7
CFLAGS = -Wall -O3 -fopenmp -Igzstream -Isrc -Isrc/models -std=c++0x
LDFLAGS = -lgomp -lgzstream -lz -lstdc++ -Lgzstream 

Error thrown is:

In file included from /usr/include/stdio.h:65:0,
                 from <REDACTED>,
                 from <REDACTED>:
/usr/include/zlib.h:663:46: error: expected initializer before '__AVAILABILITY_INTERNAL__MAC_10_13'
                                              __OSX_AVAILABLE_STARTING(__MAC_10_13,__IPHONE_11_0);
                                              ^

Taking a closer look at zlib.h at line 663:

ZEXTERN int ZEXPORT deflateGetDictionary OF((z_streamp strm,
                                             Bytef *dictionary,
                                             uInt  *dictLength))
                                             __OSX_AVAILABLE_STARTING(__MAC_10_13,__IPHONE_11_0);

There are multiple lines that throw the same error, and they are all with the __OSX_AVAILABLE_STARTING I am not sure how to fix this. I reinstalled xcode command line tools using xcode-select --install


Solution

  • Bleh.

    Reinstall gcc using brew reinstall gcc

    And also PATH=/usr/local/bin:$PATH