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
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Advice in Xamarin 21 109
Recover unsaved Tab contents (and settings/preferences) from Notepad++ 3 123
Java Inheritance super keyword use 8 38
Ruby or Python 7 61
This is about my first experience with programming Arduino.
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
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 …

726 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