Solved

linking in C++

Posted on 2003-11-04
1
212 Views
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 .
Raghava
0
Comment
Question by:raghava_dg
[X]
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
 
LVL 1

Accepted Solution

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

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
A short article about problems I had with the new location API and permissions in Marshmallow
Simple Linear Regression
Introduction to Processes

696 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