c - Makefile with multiple main functions -


all: program1 program2  program1: stringlistdemo.o     gcc -wall -std=c11 -iinclude src/stringlistdemo.c src/linkedlistapi.c -o program1  program2: structlistdemo.o     gcc -wall -std=c11 -iinclude src/structlistdemo.c src/linkedlistapi.c -o program2 

trying compile folder 2 files main functions keep getting error.

make: *** no rule make target `stringlistdemo.o', needed `program1'.  stop. 

since mention stringlistdemo.o, give no rule it, make looks implicit rule tells how update it. in other words, make looks stringlistdemo.c file apparently not exist in current directory. however, mention src/stringlistdemo.c, , program1 target apparently depends on it. should change stringlistdemo.o in prerequisite list src/stringlistdemo.o:

program1: src/stringlistdemo.o 

the same logic applies program2.


if src/stringlistdemo.c supposed compiled special options (different defaults), add stringlistdemo.o target explicitly, e.g.:

stringlistdemo.o: src/stringlistdemo.c     gcc ... 

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -