linking in C++

Posted on 2003-11-04
Last Modified: 2010-04-17
Frndz ,

I have 2 file ,  a.cpp and b.cpp    . class abc is implemented in b.cpp .
I want to instantiate a obj of class abc and use it in a.cpp . How can I do this ?

how should be my make file ?

thanks in advance .
Question by:raghava_dg
1 Comment

Accepted Solution

tegila earned 50 total points
ID: 9677950
first, add in a.cpp:
#include "b.cpp"
next step is compile your program:
gcc -c a.cpp -o a.o
gcc -c b.cpp -o b.o
gcc a.o b.o -o out.exe

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
groupNoAdj 7 95
Installed softare without GUID 6 75
Scripting vs. Programming languages 25 165
C# Error - Add Failed 12 87
This is an explanation of a simple data model to help parse a JSON feed
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question