Solved

linking in C++

Posted on 2003-11-04
1
206 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
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

This is about my first experience with programming Arduino.
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
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 …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

746 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now