首页 > 编程语言 > 详细

Setting static library in Eclipse c++ in Linux

时间:2014-02-15 16:35:50      阅读:392      评论:0      收藏:0      [点我收藏+]

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!


Setting static library in Eclipse c++ in Linux

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!