Leave these fields empty (spam trap):
Name
You can leave this blank to post anonymously, or you can create a Tripcode by using the format Name#Password
Comment
[i]Italic Text[/i]
[b]Bold Text[/b]
[spoiler]Spoiler Text[/spoiler]
>Highlight/Quote Text
[pre]Preformatted & Monospace Text[/pre]
[super]Superset Text[/super]
[sub]Subset Text[/sub]
1. Numbered lists become ordered lists
* Bulleted lists become unordered lists
File

Sandwich


Discord Now Fully Linked With 420chan IRC

fuck collect2: ld returned 1 exit status

Reply
- Wed, 21 Feb 2018 10:27:03 EST iHgPZrys No.37431
File: 1519226823005.jpg -(189873B / 185.42KB, 1600x1159) Thumbnail displayed, click image for full size. fuck collect2: ld returned 1 exit status
Hi guys, today I wanted to start learning about programming, so I wanted to do that Hello World crap thinking it would be really easy, so I wrote the program:
[CODE]#include<stdio.h>

#include<stdlib.h>

int main()

{

printf("\nHello World!");

return(0);

}[/CODE]

And for compiling it I wrote the command:
[CODE]gcc -Wall -W -Werror helloworld.c -o helloworld[/CODE]

But it didn't work and I got:
[CODE]collect2: ld returned 1 exit status[/CODE]

I googled for a solution but I didn't found anything, help me please.
>>
Jenny Crocklesug - Wed, 21 Feb 2018 11:56:25 EST 1j8iF08r No.37432 Reply
That's not the error message you want. That's just the last error message where the process was aborted. Turn off all those warning options if you can't see what came before that.
>>
Jenny Crocklesug - Wed, 21 Feb 2018 11:59:17 EST 1j8iF08r No.37433 Reply
Also I think you want
 [ pre ] 
>>
Basil Fanfuck - Thu, 22 Feb 2018 03:26:14 EST BW3MomrQ No.37441 Reply
When you tell gcc to build your program (which is basically what you did with your command to gcc), it first compiles the code files (*.c files and *.cpp files) you give it into object files (*.o or *.obj files). It then tries to link all of the generated object files into a running program. In order to do this last step, gcc needs some help, so it invokes ld to perform the linking step. In your case, OP, ld ran into an error and tried to tell you an error message.

Also your C code has some oddities to it that while they may not be causing any immediate problems, they might cause confusion if you show this code to anyone else:
  • Your printf() string starts with \n . \n is the character that when printed will cause a newline to be generated. Usually you want this at the end of your string so that your program prints a line and then moves the cursor down to the next line.
  • Your return value is wrapped in parenthesis. Try doing "return 0;" instead. The parenthesis you have surrounded the return value with should have no effect (other than making the code harder to read).
>>
Polly Debblekack - Wed, 07 Mar 2018 23:28:07 EST KhmUde/p No.37467 Reply
1520483287608.png -(1066835B / 1.02MB, 1366x768) Thumbnail displayed, click image for full size.
You have a lot going on. Look at my pic. Look at my example. Look at the directory of my terminal, and then look at the commands I used. This is as simple as it gets.

Report Post
Reason
Note
Please be descriptive with report notes,
this helps staff resolve issues quicker.