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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T11:49:55+00:00 2026-06-18T11:49:55+00:00

I am working on a Linux platform and using the GNU C++ compiler. I

  • 0

I am working on a Linux platform and using the GNU C++ compiler. I am trying to resolve a link error that says some symbols are undefined. I can go find libraries with the name provided on the command line, and see that they contain the symbols in question ( using the ‘nm’ utility ).

I know that for the compilation step, I can use the command-line flag ‘-H’ instead of ‘-c’ in order to get a list of header files that were #included into the compilation. Is there a similar option for the linker? I figure if I could see the list of files that the linker used to handle each ‘-lmylibrary’ flag, I can troubleshoot further.

  • 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-18T11:49:56+00:00Added an answer on June 18, 2026 at 11:49 am

    If you get an undefined symbol error it means you forgot to link some library, knowing which libraries you link to will probably not be as useful as you may think, because obviously the symbol is missing from those libraries, however you can use the -print-file-name=library option to find out which path gcc would use to link a library, example:

    $ gcc -print-file-name=libc.a
    /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/../../../libc.a
    

    Also passing --trace to the linker shows a similar output

    gcc -Wl,--trace myprog.c -o myprog -L. -lmylib
    -lmylib (./libmylib.a)
    -lgcc_s (/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/libgcc_s.so)
    ....
    

    (Note in the above that --trace is an argument to the linker so it goes in -Wl. gcc invoked for linking won’t emit anything useful for --trace as an argument to gcc its self).

    You could also use ldd after you successfully build the program to find out which dynamically linked libraries were used, its output looks like this:

    ldd `which ls`
    linux-vdso.so.1 =>  (0x00007fff7ffff000)
    libselinux.so.1 => /lib/x86_64-linux-gnu/libselinux.so.1 (0x00007f2e8ea93000)
    librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f2e8e88b000)
    libacl.so.1 => /lib/x86_64-linux-gnu/libacl.so.1 (0x00007f2e8e682000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f2e8e2ee000)
    ....
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to get a global hotkey working in Linux using Mono. I found
I'm working on a multi-platform OpenGL application, for which I'm using Xlib under Linux.
I am trying to port my working code from Mac OS X to GNU/Linux.
I am working on a cross platform app that will be created using C++->
Hi I'm working with C++ on Linux platform, i have to get the value
I am working on writing a network application in C++ on the Linux platform
I am working with some C code called from Python using ctypes. Somewhere in
I'm working on a C++ cross-platform OpenGL application (Windows, Linux and MacOS) and I
I am working on a multi-platform app (Mono) that will store text in a
I am working on an Android phone based on the Linux Kernel. I'm using

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.