C compile error: Id returned 1 exit status

前端 未结 11 1098
忘掉有多难
忘掉有多难 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条回答
  • 2020-12-06 19:01

    Is a simple MAYUS word. verify the log.

    0 讨论(0)
  • 2020-12-06 19:01

    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.

    0 讨论(0)
  • 2020-12-06 19:02

    Just try " gcc filename.c -lm" while compiling the program ...it worked for me

    0 讨论(0)
  • 2020-12-06 19:08

    Using code::blocks , I have solved this error by doing :

    workspace properties > build target > build target files

    and checking every project file.

    0 讨论(0)
  • 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.

    0 讨论(0)
提交回复
热议问题