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 4042118
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T12:57:56+00:00 2026-05-20T12:57:56+00:00

This is the header file and its C file: cs50.h and cs50.c Now I

  • 0

This is the header file and its C file:
cs50.h and
cs50.c

Now I use them in the following example http://www.paste.ubuntu.com/576370/ — which is no longer available.

I already put the header file in /usr/bin/include or something like that and when I try to compile my code using gcc -o xxx xxx.c, it doesn’t work, so tried to fix this and the following way worked: http://www.paste.ubuntu.com/576371/ — which is no longer available.

Now I want to do something to make the ‘make’ command work as the gcc does.

What do I need to do?


The following was the old topic:

I was using gcc command to
compile C programs but after a period
of time I got a problem. I need
to compile a new header file and use
it as a library.

The header file called cs50.h.

so after doing it and it’s ok I can
compile using the following

gcc -o xxx xxx.c -lcs50

It works but now I want to use ‘make’
command and I can’t get it to work.

It just don’t compile the header file
and library as gcc was before I edit
it to accept the cs50 library.

So now I want to add to the ‘make’
command the following: -lcs50

Can anyone help me in this please?

  • 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-05-20T12:57:57+00:00Added an answer on May 20, 2026 at 12:57 pm

    Near the top of your Makefile, add the line:

    LDLIBS = -lcs50
    

    If you are using Make’s default (implicit) rules for the building, then that is all you need to do. If you are using explicit rules, you will need to add $(LDLIBS) to your explicit rules.

    If there is no Makefile, then make is using default rules, and you can either just create a makefile with

    echo LDLIBS = -lcs50 > Makefile
    

    or tell make to link with certain libraries by specifying the required libraries in LDLIBS in the environment. For example, if you are using a sh-derived shell (anything other than csh or tcsh) you can do:

    LDLIBS=-lcs50 make target
    

    If you are using a csh variant, you can do:

    env LDLIBS=-lcs50 make target
    

    or just do (again, for non-csh shells)

    export LDLIBS=-lcs50
    

    before running make. (For csh variants, do setenv LDLIBS -lcs50)

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

Sidebar

Related Questions

I have .lib file with its header (.h) file. This file have a few
I have a header file. In this header I want to use a map
I have the following C Header/Code Example: Header file struct category_info { int id;
I have this header file, zeeheader.h, and I wrote some classes in it, I'm
I have a macro definition in header file like this: // header.h ARRAY_SZ(a) =
I have registered an enumeration type ClefType within my header file - this enum
I have a header file like this: #ifndef __GEN_NOTE_MARKERS_TO_DEVELOPERS_HPP__ #define __GEN_NOTE_MARKERS_TO_DEVELOPERS_HPP__ #ifdef _DEBUG //
I've declared a struct in my header file like this: typedef struct { NSString
I'm not totally sure but this looks wrong: I have a header file named
If I set a far future expire header for this file (take note of

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.