Compiling Objective-C in terminal on Mac OS -


i quite new both writing makefiles , objective-c language. trying compile small test application makefile:

q = @ include_pref = -i  cc := gcc   #here source files specified  list_src_files = $(shell find . -type f -name "*.m") srcs := $(subst ./,,$(call list_src_files))  #here our include files  list_include_dirs = $(shell find . -type d -name "include") include_ls := $(call list_include_dirs) include_dirs := $(include_pref). include_dirs += $(addprefix $(include_pref), $(subst ./,,$(include_ls)))  #flags used gcc  cflags = -wall -fobjc-arc -framework foundation -g -o0 $(include_dirs)  #here object files specified  objs := $(srcs:%.m=%.o)  #here name of target specified  target := convertor  #here our target  $(target): $(objs)            @echo "building target"            $(q)$(cc) $(cflags) $^ -o $@  %.o: %.m       @echo "building objects"      $(q)$(cc) $(cflags) -c $< -o $@  .phony: clean  clean:       $(q)-rm $(objs) $(target) 2>/dev/null || true 

the code trying compile is:

#import <foundation/foundation.h>   #define debug #define valid_parms_nbr   3     #ifdef debug # define dbg(fmt, ...) nslog((@"%s " fmt), __pretty_function__,  ##__va_args__) #else # define dbg(...) #endif    int main (int argc, char *argv[]) {   if (argc < valid_parms_nbr) {     nslog(@"usage of program is: prog_name arg1 arg2");   } else {     dbg(@"parameters: %s, %s, %s\n", argv[0], argv[1], argv[2]);   }     return 0; } 

the warning compiler throwing me everytime:

clang: warning: -framework foundation: 'linker' input unused 

could you, please, point me, did mistake in makefile? , why warning appears?

i looking through similar questions, nothing worked.

the warning indicates foundation framework statement isn't used, , can removed:

cflags = -wall -fobjc-arc -g -o0 $(include_dirs) 

removing cflags line should resolve things.

warnings — warn behavior might not problem, aware of. despite program might compile anyway, although it's have mindset fix it.


Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -