Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8759395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T14:47:33+00:00 2026-06-13T14:47:33+00:00

I have problems generating a small hello-world program in C with ld as linker.

  • 0

I have problems generating a small hello-world program in C with ld as linker.

These are my steps so far:

gcc -c hello.c
ld -o hello hello.o -lc

./hello
-bash: ./hello: no such file or directory

hello.c‘s source is here:

#include <stdio.h>
int main(){
    puts("Hello, world!");
    return 0;
}

It seems I have missed an important part here. Neither gcc nor ld had any errors and both ended with return value 0.

Please do not tell me “just use gcc -o hello hello.c“! I have browsed like 10 boards and people always gave that answer. I want to know how to do it the ld-way.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T14:47:34+00:00Added an answer on June 13, 2026 at 2:47 pm

    If you want to understand what GCC is actually doing, run it with the -v flag. (For example, gcc -v -o hello hello.c.)

    You’re missing some pieces of code that GCC would normally instruct the linker to include. If you look at the output of gcc -v, you’ll see things like crt1.o -lgcc -lgcc_s and others.

    See also the GCC documentation for options such as -nostartfiles, -nodefaultlibs, and -nostdlib for some context on these extra bits of code that are being linked in behind the scenes.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am generating new xml file using perl script but I have small problem,
TL;DR: I have problems with PHP generating PDF's longer than 1 page total. Hello
I have problems trying to load png file into my application. It seems to
Background I have a Spring batch program that reads a file (example file I
I have a problem with generating an XML that needs to be generated automatically
I have a problem with random number generating in C# I have tried all
I'm generating dynamic HTML inside Delphi. I have no problem displaying UTF-8 strings inside
i have problems with a really basic thing. setting properties after instantiation a UIViewController-
I have problems with creating a simple Group-Box-Control via CreateWindowEx. The font-size/-style of its
I have problems with CSS. The table is creating white border and I do

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.