. Advertisement .
..3..
. Advertisement .
..4..
For the problem “c++ id returned 1 exit status” I tried to fix it, but it doesn’t work and returns the result I want. Here is my program:
#include <stdio.h>
#include<conio.h>
#include<windows.h>
int main()
{
int P, N, NP=0;
printf("Introduzca en nombre del producto:\n");
scanf("%f", &N);
printf("Introduzca en precio del producto:\n");
scanf("%f", &P);
if (P <= 1500)
NP=P*1.11;
else
NP=P*1.08;
printf("El producto %d cuesta %d", NP, N);
getche();
return 0;
}
and
*** Start Block ***
Permission denied Id returned 1 exit status
has occurred. I’ve checked the entire command line but still can’t find the mistake.
The cause:
You have got the ”c++ id returned 1 exit status” error because your operating system does not permit file modification while it is active, the compilation (really, linking; ld is the linker) process does not success due to the compiler is unable to replace the existing executable with a new one.
Solution:
You can solve this problem by excluding the executable(.exe) files which have existed in your program. However, one thing you need to keep in mind is that you might not be able to delete the outdated.exe file if you compile the code more than once.
If above way is not effective, you have to check your privilege for directory that contains the executable, or find the programs which are using it at the moment.
It has nothing to do with code. The operating system doesn’t allow you to modify files while they are in use. This causes the compilation (actually linking,
ld
being the linker) to fail. It can’t remove an executable and replace it with a new one. This can be solved by closing all processes that are currently running the program.If this doesn’t work, you can check the permissions of the directory where the executable is located, or search for other programs using it. Some systems allow programs lock files so that no other programs can modify them.