473,383 Members | 1,798 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

3 files = 1 program HELP!

Im very n00b to programming and im working on this project..... and
I've got 3 different files....a header file ('file.h'), an
Implementation file ('file.cpp') and a driver file ('driver.cpp'). In
both the file.cpp and driver.cpp files..i put #include "file.h" ...but
im pretty sure thats wrong...i mean how does the driver file know how
to include my "file.cpp" implementaion file?? HELP THIS plz
tx...

Sep 20 '05 #1
9 1296
fi********@gmail.com wrote:
Im very n00b to programming and im working on this project..... and
I've got 3 different files....a header file ('file.h'), an
Implementation file ('file.cpp') and a driver file ('driver.cpp'). In
both the file.cpp and driver.cpp files..i put #include "file.h" ...but
im pretty sure thats wrong...
No it's right.

i mean how does the driver file know how to include my "file.cpp" implementaion file?? HELP THIS plz
tx...


It doesn't. This is called seperate compilation. Each cpp file is
compiled seperately. Then a final stage called linking brings the two
files together.

How exactly is it going wrong for you?

john
Sep 20 '05 #2
Hi john,
Tx for the responce...
Well I wrote the implementation file which ONLY contains the fully
coded functions that are contained within the classes described in the
header file 'file.h'. Then the driver file uses what is contained in
both the header file and the implementation file....my question is HOW
do i "link" (as you say) these files together so that when i compile
and run the driver file...it will know to use both the .h file and the
..cpp file (implementaiton file)....
once again the three files are: ('file.h' (header) 'file.cpp'
(implementation) 'driver.cpp'

Sep 20 '05 #3
fi********@gmail.com wrote:
Hi john,
Tx for the responce...
Well I wrote the implementation file which ONLY contains the fully
coded functions that are contained within the classes described in the
header file 'file.h'. Then the driver file uses what is contained in
both the header file and the implementation file....my question is HOW
do i "link" (as you say) these files together so that when i compile
and run the driver file...it will know to use both the .h file and the
.cpp file (implementaiton file)....
once again the three files are: ('file.h' (header) 'file.cpp'
(implementation) 'driver.cpp'


This depends on your compiler / development environment. For a typical
command line compiler it usually suffices to enter the single command:
<compiler command> <all .cpp file names>. In your case, if you were
using gcc, you'd enter: gcc file.cpp driver.cpp

This will tell the compiler to first compile each .cpp file separately
and then link the resulting "object files" into a single executable
(often named a.out by default).
Sep 21 '05 #4
I'm using Microsoft Visual C++ V. 6.0 .... I have the three files in
the same directory and I simply executed the driver file....and got
run-time errors so I'm assuming that I'm missing something.

Sep 21 '05 #5
On 20 Sep 2005 18:01:18 -0700, fi********@gmail.com wrote:
I'm using Microsoft Visual C++ V. 6.0 .... I have the three files in
the same directory and I simply executed the driver file....and got
run-time errors so I'm assuming that I'm missing something.


If you got "run-time" errors you compiled and linked your program
successfully, otherwise there would be no executable to run.
I believe you meant "build" time errors (meaning either compile or
link errors)

I do not have Visual Studio in front of me, so the details may be
slightly wrong, but you need to do to do the following:

(a) Create a "workspace", which is a general repository for projects,
files, resources, etc.

(b) Create a "project" and add it to the workspace in (a) You need to
chose what the project will be: A console application, a full windows
application, a library, a dynamic link library, etc.

(c) "Add files" to the project.

(d) Then "build" it.

If you still have problems you should ask in a forum / newsgroup
dedicated to Visual C++ (look at the various microsoft.public.????
newsgroups) This newsgroup is for generic C++, not for details that
are particular to Visual C++.

Sep 21 '05 #6
Thank you very much Roberto........that totally answered my question
and I apologize for 1) not being specific as to my question and 2) not
posting in the correct newsgroup. Thanks again

Sep 21 '05 #7


fi********@gmail.com wrote:
Thank you very much Roberto........that totally answered my question
and I apologize for 1) not being specific as to my question and 2) not
posting in the correct newsgroup. Thanks again


What a polite young man.

Sep 21 '05 #8
Havatcha wrote:
fi********@gmail.com wrote:
Thank you very much Roberto........that totally answered my question
and I apologize for 1) not being specific as to my question and 2) not
posting in the correct newsgroup. Thanks again


What a polite young man.


He is isn't he?

Sep 22 '05 #9
sh********@gmail.com writes:
Havatcha wrote:
fi********@gmail.com wrote:
> Thank you very much Roberto........that totally answered my question
> and I apologize for 1) not being specific as to my question and 2) not
> posting in the correct newsgroup. Thanks again
>


What a polite young man.


He is isn't he?


Yes, definitely. It's a shame that such manners are so rare as to be worthy of
comment though. Courtesy should be the rule, not the exception. :-(

sherm--

--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
Sep 22 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Mike | last post by:
I am sure that I am making a simple boneheaded mistake and I would appreciate your help in spotting in. I have just installed apache_2.0.53-win32-x86-no_ssl.exe php-5.0.3-Win32.zip...
7
by: MAK | last post by:
Hello everyone, I know how to add images and icons etc to dll file. What I would like to know is there is a way to add those icons on the forms during the run time from the dll or to reference it ...
44
by: Xah Lee | last post by:
here's a large exercise that uses what we built before. suppose you have tens of thousands of files in various directories. Some of these files are identical, but you don't know which ones are...
0
by: Tom Lee | last post by:
Hi, I'm new to .NET 2003 compiler. When I tried to compile my program using DEBUG mode, I got the following errors in the C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7 \include\xdebug...
2
by: | last post by:
I seem to have a small problem using html help files in .NET. I created a program.chm file, and this one is located at the same location of the .NET program.exe. So I want to use following...
9
by: John J. Hughes II | last post by:
Is it possible using Image or Bitmap to build and save an animated GIF file? I am not have a problem saving the GIF file just getting the frames added to it. I did find ImageAnimator but it only...
6
by: Charles Neitzel | last post by:
I'm trying to write a windows application in C# (Using Microsoft Visual C# 2005 Express) that is nothing more than a simple UI with buttons on it. The buttons do various things like running...
1
by: Charles | last post by:
I'm trying to write a windows application in C# (Using Microsoft Visual C# 2005 Express) that is nothing more than a simple UI with buttons on it. The buttons do various things like running...
9
by: Bob Achgill | last post by:
I would like to use the timestamp on files to manage the currency of support files for my VB windows application. In this case I would only put the timestamp of the file in the management database...
18
by: UJ | last post by:
Folks, We provide custom content for our customers. Currently we put the files on our server and people have a program we provide that will download the files. These files are usually SWF, HTML or...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.