Setting static library in Eclipse c++ in Linux

时间:2014-02-15 16:35:50   收藏:0   阅读:397

1. Build static library project from Eclipse.

bubuko.com,布布扣


2. Create header (hello.h) and source (hello.cc) file. Build them to create the static library.

bubuko.com,布布扣

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.

bubuko.com,布布扣


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. 

bubuko.com,布布扣


5. Add static library so that output() is declared.

bubuko.com,布布扣


Now the test project is able to run correctly!


原文:http://blog.csdn.net/jsc0218/article/details/19235681

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!