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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T23:30:02+00:00 2026-05-20T23:30:02+00:00

From what I have learned I need to follow this step to prepare for

  • 0

From what I have learned I need to follow this step to prepare for making a shared library:

gcc -fPIC libfoo.c -o libfoo.o

And then I link it. I had tried making a makefile to aid in these steps, but there appears to be errors happening now.

This occurs when I run the make file:

foo@box:~/Projects/so$ gcc -fPIC ./libfoo.c -o libfoo.o
/usr/lib/gcc/i686-linux-gnu/4.4.5/../../../../lib/crt1.o: In function `_start':
(.text+0x18): undefined reference to `main'
collect2: ld returned 1 exit status

How can I compile the library file without the main function, as it is not a program and is intended to be a library?

If it helps my program is basically this (interpreted)

(stdio and openssl headers here)

(debugging macro definitions here)

(two functions, gettime() and opensslrandom() defined here)

I seem to have problems understanding about the macros as well, as they would be in the shared library in the end they are useless in the shared library? I included them in libfoo.h to be included, although I have yet to see if the macros work.

  • 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-20T23:30:03+00:00Added an answer on May 20, 2026 at 11:30 pm

    You need -c

    gcc -fPIC -c libfoo.c 
    

    for generating the object files.

    You may want to look at: http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html

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

Sidebar

Related Questions

from the scarcely documented FB api, I have thus far learned that I need
I have learned from the sencha doc how to create a simple MVC application,
I have learned from various tutorial that If a client can reasonably be expected
In my studies, I have learned that if you want to prevent users from
I learned of gist.github.com from Mozilla Ubiquity , and have been using it to
I have (from the sed website http://sed.sourceforge.net/sed1line.txt ) this one-liner: sed -e '/./{H;$!d;}' -e
This is what I learned by doing some searching. These things were taken from
I have learned that you need to call dispose() on Graphics objects that you
I have a asp.net web content from that have a asp.net textbox and I
do routed events from wpf have something in common with the chain of responsibility

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.