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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T17:57:29+00:00 2026-06-16T17:57:29+00:00

I know there are many questions related to shared libraries on Linux but maybe

  • 0

I know there are many questions related to shared libraries on Linux but maybe because I’m tired of having a hard day trying to create a simple dynamic library on Linux (on Windows it would have taken less than 10 minutes) I can’t find what happens in this case.
So, I am trying to create a library to be linked at build-time and used at run-time (not a static library, not a library to be embedded into the executable, in other words). For now it contains a simple function. These are my files:

1.

// gugulibrary.cpp
// This is where my function is doing its job

#include "gugulibrary.h"

namespace GuGu {
    void SayHello() {
        puts("Hello!");
    }
}

2.

// gugulibrary.h
// This is where I declare my shared functions
#include <stdio.h>

namespace Gugu {
    void SayHello();
}

3.

// guguapp.cpp
// This is the executable using the library
#include "gugulibrary.h"

int main() {
    GuGu::SayHello();
    return 0;
}

This is how I try to build my project (and I think this is what is wrong):

gcc -Wall -s -O2 -fPIC -c gugulibrary.cpp -o gugulibrary.o
ld -shared -o bin/libGugu.so gugulibrary.o
gcc -Wall -s -O2 guguapp.cpp -o bin/GuGu -ldl
export LD_LIBRARY_PATH=bin

This is saved as a .sh file which I click and execute in a terminal. The error I get when trying to link the library is this:

/tmp/ccG05CQD.o: In function `main':
guguapp.cpp:(.text.startup+0x7): undefined reference to `SayHello'
collect2: ld returned 1 exit status

And this is where I am lost. I want the library to sit in the same folder as the executable for now and maybe I need some symbols/definitions file or something, which I don’t know how to create.
Thanks for your help!

  • 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-16T17:57:30+00:00Added an answer on June 16, 2026 at 5:57 pm

    You are inconsistent with your GuGu, there are also Gugu’s running around, this needs to be made consistent, then it works (At least on my computer are some Gugu’s now)

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

Sidebar

Related Questions

I know that there are many Delphi database related questions available, but I'm considering
Note : I know there are many questions related to this, but still I
I know there are many questions similar but any of them didn't help. in
NOTE: I know there are many questions that talked about that but I'm still
I know there are already many questions like mine but I found no answer
I do know there are already many questions on Stackoverflow related to custom error
I know there are many JSON with GSON questions but none of them relate
There are many people asking questions related to this issue, but none are complete
There are many questions related to Stackless Python. But none answering this my question,
I know there are many other posts on here with similar questions, but I

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.