1. Build static library project from Eclipse.
2. Create header (hello.h) and source (hello.cc) file. Build them to create the static library.
codes of hello.h
#ifndef HELLO_H_ #define HELLO_H_ void output(); #endif /* HELLO_H_ */
codes of hello.h
#include <iostream> using namespace std; void output() { cout<<"I am static library!"<<endl; }
3. Build test project. But hello.h could not be found and output() is not declared, if we try to build the project.
4. Add Includes so that hello.h could be found. One can also add Includes through C/C++ Build->Settings->Tool Settings->GCC C++ Compiler->Includes.
5. Add static library so that output() is declared.
Now the test project is able to run correctly!