Makefile:xxx: recipe for target ‘xxx’ failed

When using makefile to run the executable file generated in the current directory: m akefile:3 : recipe for target 'test' failed similar error. It is very likely that the value returned to make after the program running is not 0.

1.test.c

#include<stdio.h>

int main(){
	
	printf("----------------\n");

	return 2;
}

2. Makefile
target: requests
[tab] command
must be preceded by the tab key

test : test.c
	clang test.c -o test 
	./test 

Command line running: make test

3. Modify the return value of the end of test. C program

#include<stdio.h>

int main(){
	
	printf("----------------\n");

	return 0;
}

4. Command line operation: make test

business as usual!

Similar Posts: