C compile error: Id returned 1 exit status

前端 未结 11 1100
忘掉有多难
忘掉有多难 2020-12-06 18:25

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

11条回答
  •  -上瘾入骨i
    2020-12-06 19:09

    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

    • Can't find the object file to be linked (or Access denied)
    • Can't find one or more symbols to link
    • Can't open the executable for writing (or AD)

    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.

提交回复
热议问题