-4

I am learning c pragramming and when I try to print "Hello World" in quotation I get an error:

id returned 1 exit status

Here is my code, I am using codeblock:

#include <stdio.h>

int main()
  {
    printf("\"Hello World\" ");

    return 0;
}
Jabberwocky
  • 48,281
  • 17
  • 65
  • 115

1 Answers1

5
error: id returned 1 exit status 
       ^
 should be "l", not "i"

I believe it's ld, not id. Code::Blocks uses GCC as compiler, and this is extremely likely that you did not close the running program before trying to compile it again.

Generally, ld (ld.exe on Windows) 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)

Your 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.

A simple Google search gives a full page of the same answer: You forgot to close the program, before trying to re-compile.

That's all.

iBug
  • 35,554
  • 7
  • 89
  • 134
  • 4
    Great spot. And this is why retyping the error message (instead of copy&pasting) is a bad idea! – Steve Nov 16 '17 at 13:48
  • @Steve - FYI, In some environments, such as the Code::Blocks IDE, _copy/paste_ is not enabled from the Build messages output tab. Unfortunate, but true. – ryyker Nov 16 '17 at 14:08
  • 1
    @ryyker Good grief - _really_? – Steve Nov 16 '17 at 14:09
  • @Steve - Yes. It is true not only for Code::Blocks, eg. LabWindows/CVI from National Instruments does not. Of course, others do allow copying, such as Visual Studios. – ryyker Nov 16 '17 at 14:21
  • I closed it and tried but same error again – Smer Abonwara Nov 17 '17 at 13:49
  • here is a message from the logs C:/Program Files (x86)/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/4.9.2/../../../../mingw32/bin/ld.exe: cannot open output file C:\Users\samjo\Desktop\technion\c programming\hw1\Hw0qq2.exe: Permission denied collect2.exe: error: ld returned 1 exit status – Smer Abonwara Nov 17 '17 at 13:51
  • @SmerAbonwara Try deleting existing EXE file first. – iBug Nov 17 '17 at 13:51
  • Tried it same problem – Smer Abonwara Nov 17 '17 at 16:31
  • The problem is when I give it another name it worked but I have to give it specific name to send it to my college – Smer Abonwara Nov 17 '17 at 16:34
  • when you saying close the program before recompile do you mean to close the codeblog and then open it again? maybe I didnt understand you well – Smer Abonwara Nov 17 '17 at 17:42