[Solved] Vs error: link: fatal error lnk1168: unable to open for writing

Project scenario:

use VS to program in C language and generate solution report – > Execution error


Problem Description:

error: link: fatal error lnk1168: unable to open C:\users\86139\desktop\plan\notes\C\tryproject \ debug\tryproject.exe for writing

#include <stdio.h>
#include "math.h"//Since the library function sqrt() is to be used

int main(){
	//Requirement: determine if the quadratic function has real roots, and output if it does?
	double a,b,c,disc,x1,x2,p,q;//declare variables
	printf("Please enter the values of a,b,c respectively: \n");
	scanf("%lf%lf%lf",&a,&b,&c);//enter the value and store it at address a,b,c
	disc=b*b-4*a*c;//discriminant
	if(disc<0){
		printf("This equation has no real roots!!!");
	}else{//disc>=0
		p=-b/(2.0*a);
		q=sqrt(disc)/(2.0*a);
		x1=p+q;
		x2=p-q;
		printf("此方程的两实根为:\nx1=%7.2f\nx2=%7.6f\n",x1,x2);
	}
}

Cause analysis:

the process may already exist, so it cannot be opened and run


Solution:

just finish the process of the program. You can open “process manager” (Task Manager), Ctrl + Alt + delete, find the corresponding process, and right-click to finish.

Read More: