Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creat Lib file

Status
Not open for further replies.

KingOfJava

Programmer
Feb 21, 2003
7
US
//Example.cpp

// MAIN FILE : It make use of Test.h and Test.cpp

#include "Test.h"

int main(){
Test *t = new Test("KingOfJava");
cout << t->getMessage() << endl;
}

//++++++++++++++++++++++++++++++++++++++++

//Test.h

#include <iostream>
#include <string>
using namespace std;

class Test{

string msg;

public:

Test(string s);

string getMessage();


};

//++++++++++++++++++++++++++++++++++++++++

// Test.CPP

#include &quot;Test.h&quot;

Test::Test(string s){
msg = s;
}
string Test::getMessage(){
return msg;
}
//+++++++++++++++++++++++++++++++++++++++++++++++++

I am new to CPP and I wanted to creat an example of Lib file.

I have created a header file I wanted to put it in Include directory of Borland comp

Test.cpp I wanted to creat an object file out of it. And wanted to put it in Lib directory.

And I wanted to write an example program which make use of them.

Please help how to do them.

Thanx in advance,

Regards,
 
In Builder6, before you compile click on Project, then click on Options, then check the default box at the left side bottom, then Save All, then click on Project, then on Build Project, and the compiler will create the *.lib file.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top