For some reason, when I try compiling a program, the compiler says permission denied and Id returned 1 exit status. Could anyone tell me what that means? Thank you
Is a simple MAYUS word. verify the log.
This answer is written for C++ developers, because I was haunted by such problem as one. Here is the solution:
Instead of
main()
{
}
please type
int main()
{
}
so the main function can be executed.
By the way, if you compile a C/C++ source file with no main function to execute, there will definitely be a bug message saying:
"[Error] Id returned 1 exist status"
But sometimes we just don't need main function in the file, in such a case, just ignore the bug message.
Just try " gcc filename.c -lm" while compiling the program ...it worked for me
Using code::blocks , I have solved this error by doing :
workspace properties > build target > build target files
and checking every project file.
I bet for sure, that this is because you didn't close the running instance of the program before trying to re-compile it.
Generally, ld.exe
returns 1 when it can't access required files. This usually includes
Access denied
)The program looks completely fine, so the second point should not hit. In usual cases, it's impossible for ld
to fail to open the object file (unless you have a faulty drive and a dirty filesystem), so the first point is also nearly impossible.
Now we get to the third point. Note that Windows not allow writing to a file when it's in use, so the running instance of your program prevents ld.exe
from writing the new linked program to it.
So next time be sure to close running programs before compiling.