Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22118

How to write Makefile to compile c and c++ on Mac OSX

$
0
0

I downloaded git project.

I'm trying to compile with makefile on Mac OSX(10.14.6)

but I failed with this error

I guess trying to compile mix of c and cpp file make this error

But it works in Ubuntu 16.04

How can I fix it?

terminal

clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]audio.c:140:15: error: assigning to 'PrivateAudioDevice *' (aka'privateAudioDevice *') from incompatible type 'void *'    gDevice = calloc(1, sizeof(PrivateAudioDevice));              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~audio.c:166:30: error: assigning to 'Audio *' (aka 'sound *') from incompatible      type 'void *'    global = (gDevice->want).userdata;             ~~~~~~~~~~~~~~~~^~~~~~~~audio.c:243:13: error: cannot initialize a variable of type 'Audio *'      (aka 'sound *') with an rvalue of type 'void *'    Audio * new1 = calloc(1, sizeof(Audio));            ^      ~~~~~~~~~~~~~~~~~~~~~~~~audio.c:309:16: error: assigning to 'Audio *' (aka 'sound *') from incompatible      type 'void *'        new1 = malloc(sizeof(Audio));               ^~~~~~~~~~~~~~~~~~~~~4 errors generated.

Makefile

# PathsOPENCV_PATH=/usr/local/include/opencv# ProgramsCC=CXX=g++# FlagsARCH_FLAGS=OPENCV = `pkg-config opencv --cflags --libs`LIBS = $(OPENCV)CFLAGS=-Wextra -Wall $(ARCH_FLAGS) -O3 -Wno-long-longLDFLAGS=$(ARCH_FLAGS)DEFINES=INCLUDES=-I$(OPENCV_PATH)/include -Iinclude/LIBRARIES=-L$(OPENCV_PATH)/lib -lopencv_core -lopencv_videoio -lopencv_highgui -lopencv_imgproc -lopencv_objdetect -lopencv_highguiLINKER_FLAGS = -framework OpenGL -framework GLUT -lm -lSDL2 -lstdc++ -fpermissive -pthread[...]%.o: %.cc Makefile    @# Make dependecy file    $(CXX) -MM -MT $@ -MF $(patsubst %.cc,%.d,$<) $(CFLAGS) $(DEFINES) $(INCLUDES) $<    @# Compile    $(CXX) $(CFLAGS) $(DEFINES) -c -o $@ $< $(INCLUDES) $(LIBS)-include $(DEPENDENCY_FILES)bin/face_tracker: $(ALL_OBJECTS)    $(CXX) $(LDFLAGS) -o $@ $(ALL_OBJECTS) audio.c  $(LIBRARIES) $(LINKER_FLAGS) $(LIBS)[...]

Viewing all articles
Browse latest Browse all 22118