外部の静的ライブラリにコンパイルしようとしているクラスがいくつかあります。私のlinked_list.hpp(コンパイルしようとしているlinked_listのヘッダー)は次のようになります。
#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
私のコードヘッダーはすべて「header」ディレクトリにあり、実装は私が持っている実装フォルダにあります。これらは-Iディレクトリとして渡されます。
コンパイル用のmakefileコマンドは次のようになります。
static: $(DEPENDENCIES)
ar rcs liblist_templates.a node.o list_base.o linked_list.o
実行すると、このエラーが発生します...
/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)
「linked_list.hpp」とライブラリの他のいくつかの部分を含むマスターヘッダーファイルを作成しましたが、それをインクルードするたびに、インクルードされているcppファイルを探しているようです。私はこれで何が間違っていますか?このコードから既存のプロジェクトにドロップできるポータブルライブラリを作成したいと思います。