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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:10:56+00:00 2026-06-15T10:10:56+00:00

I have some classes that I am trying to compile to an external static

  • 0

I have some classes that I am trying to compile to an external static library. My linked_list.hpp (header for linked_list I’m trying to compile) looks like:

#include "list_base.hpp"

template <typename T>

class Linked_list : public List_base <T> {


    public://
        Linked_list();
        ~Linked_list();

    public://accessor functions
        Linked_list<T> * next();//go to the next element in the list
        Node<T> * get_current_node() const;//return the current node
        T get_current() const;//get the current data
        T get(int index) const;//this will get the specified index and will return the data it holds

    public://worker functions
        Linked_list<T> * push(T value);//push a value into the front of the list
        Linked_list<T> * pop_current();//deletes the current_node--resets the current as the next element in the list!
        Linked_list<T> * reset();//this resets the current to the front of the list
        Linked_list<T> * erase(int index);

    private://variables
        Node<T> * current;//store the current node


};

#include "linked_list.cpp"//grab the template implementation file


#endif

All of my code headers go in the “header” directory and the implementation goes in the implementation folders I have. These are passed as -I directories.

My make file command for compiling looks like this:

static: $(DEPENDENCIES)
    ar rcs liblist_templates.a node.o list_base.o linked_list.o 

and upon running it gives me this error …

/usr/bin/ranlib: warning for library: liblist_templates.a the table of contents is empty (no object file members in the library define global symbols)

I created a master header file that includes the “linked_list.hpp” and a few other pieces of the library but whenever I include it, it still seems to be looking for the cpp files that are included. What am I doing wrong with this? I want to create a portable library that I can drop into existing projects from this code.

  • 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-15T10:10:57+00:00Added an answer on June 15, 2026 at 10:10 am

    If your library only contains template code, it can not be compiled in itself: for example, the compiler does not know which type will be used as T in the linked list.

    When you compiled linked_list.cpp, the compiler only realized basic syntax checks and generated an empty object file. ranlib is then complaining since you ask him to create an empty library out of all these empty object files.

    The solution is simple: do nothing! Your client code only needs the source files; it doesn’t need to be linked against any library. And you’ll always need to ship the .cpp files, since the compiler can not do anything without them.

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

Sidebar

Related Questions

I have some c++ classes that I'd like to compile into a dll file.
I have authored some custom classes that I would like to create using XAML:
I have a jsp page that is trying to reference some user defined classes.
I'm trying to compile some C++ files that have the same name (fileA) but
I have some classes that are used for Styling and all of them display
I have some classes that represent immutable objects (Quantity, Price, Probability). Is there some
I have some classes that, for one reason or another, cannot be or need
In one of my projects, I have some classes that represent entities that cannot
I have some classes in my app that don't require an ID to be
I have implemented PullRefreshTableViewController with some classes that take no delegates, and it works

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.