![]() |
|
#1
|
|||
|
|||
Class definitionsI have a complete file that compiles easily. I need to separate out the class and function prototypes into one file, the function definitions into another file and leave the main body in the original file. I can get it to work with just the header.h and main.cpp, but when I put the class function definitions into another file I can't figure out how to get that third file included.
|
|||
|
#2
|
||||
|
||||
Re: class definitions#include "the-third-file"
__________________
During the election they said Obama could only be elected when pigs fly. Well, we currently have an epidemic of Swine Flu. Coincidence? |
|
#3
|
|||
|
|||
Re: class definitionsQuote:
The problem of linking together separate source files is a matter of how the project is being compiled. If it is being compiled from a command line, and the compiler is GNU g++, for example, then a single file might be compiled by something like Code:
A command line to compile and link two source files together might look like Code:
In other words, you can simply put all of the source file names (not the header(s)) on the command line. It works the same way with various other compilers, too. If you are using a Microsoft command line compiler, cl.exe, then a single file would be compiled with something like: Code:
And for two source files to be compiled and linked together you could have something like Code:
If you are compiling from an Integrated Development Environment like Visual Studio or Borland Builder, then you should learn how to add multiple files to the project so that they will all get linked together. Regards, Dave |
|
#4
|
|||
|
|||
Re: class definitionsQuote:
and name it . then go to header file insert your code it should lokks like this CPP / C++ / C Code:
CPP / C++ / C Code:
CPP / C++ / C Code:
|
Recent GIDBlog
Programming ebook direct download available by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Returning a Struct to a separate class | usmsci | C++ Forum | 9 | 07-Feb-2007 09:34 |
| Hard drive/CPU Diagnoses Issues | binarybug | Computer Hardware Forum | 1 | 22-Jan-2007 20:23 |
| Box Class, need help again :( | TransformedBG | C++ Forum | 7 | 13-Nov-2006 16:11 |
| C++ class -- Please help | vnca_1 | C++ Forum | 3 | 14-Jun-2006 13:31 |
| a tester class and then some. | postage | Java Forum | 1 | 06-May-2006 16:48 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The