You are here:

C++/Compiling multiple CPPs


1) I am using Borland C++BuilderX at the moment, personally I like Digital Mars Compiler, because it's very simplistic with no IDE.  But it doesn't have the "gotoxy()" function, so I have to use a Borland product.
2) I have the source to a program, which would normally be fine.  However it consists of a ".asp, .dsw, .plg, .opt, header file, and two .cpp's".  And I have no idea how to compile more than just one cpp.
3) I have been trying to figure out how to make my linker do it
4) I think that it has something to do with the linker, but I dont know.

Sorry it has taken so long for me to answer your question; I've been swamped these last few days. As I recall, the way I did it was by using the #include<filename.extension>, just like you would do with #include<iostream.h> (or without the .h, depending if you use the 'namespace std;' code or not). However I remember occasionally having problems with the linker not being able to find the specified file I was including. Sometimes you can include the filepath for the file that's being included (i.e. #include<C:\Folder\filename.extension>), but not all compilers support that.

One thing I do know that works is putting the other .cpp (or any other files) that you want to include into the folder where all the other .h files are when you installed your compiler. If you think about it, when you #includ iostream.h (or any other well known .h file), you don't specify a filepath - the compiler looks in a pre-defined location. If you were to put the other files you wanted to include in there, you should be able to #include them without a problem. I hope this helps you.

Best Of Luck,


All Answers

Answers by Expert:

Ask Experts


Alan F.


Having problems with any basic or intermediate parts of C++? I can answer those questions for you using simple English. I have been taking C++ in school for a couple years, so I still remember what it was like to be a beginner (especially with C++, which is a difficult language)!


I have a C++ web page that discuses the basics of C++. The address is:

©2016 All rights reserved.