![]() |
|
#1
|
|||
|
|||
More than one file.When compiling more than one file at once, do you have to put the include statements in all the files that need them, or just the main?
Ex. Can you do this: File 1: class A { public: int a; A() { a = sqrt(2835); } }; File 2: class B { public: int b; B() { b = pow(2416, 4) } }; File 3: #include <iostream> #include <cmath> using namespace std; int main() { A a; B b; cout << a.a; cout << b.b; } Or would each file have to include <cmath> ? Thanks.. |
|
#2
|
||||
|
||||
|
Quote:
It depends. Are File 1 and File 2 header files or code files? If they are the actual code (.cpp) files, then they would each need to have the include statement. If they were header files, then the include would only need to be in main, but before your own includes. |
Recent GIDBlog
Developing GUIs with wxPython (Part 2) by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Reading from file | jmenendezr | C++ Forum | 2 | 26-Feb-2006 16:00 |
| Limited file size.... | lament | Apache Web Server Forum | 2 | 31-May-2004 13:35 |
| How to search a huge text file for data? | JdS | MySQL / PHP Forum | 7 | 27-May-2003 09:27 |
| Sydog's DVD to Divx Conversion Guide | asanthadenz | Computer Software Forum - Windows | 1 | 14-Mar-2003 14:08 |
| How Do i get php to find out the file type of a file for me? | viperman95833 | MySQL / PHP Forum | 2 | 08-Mar-2003 09:48 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The