![]() |
|
#1
|
|||
|
|||
Compiling multiple files in DevC++I having problems compiling a header and and a .cpp file in a project.
I get message: "The system cannot find the file specified Main.cpp CPP / C++ / C Code:
CPP / C++ / C Code:
Last edited by admin : 06-Sep-2008 at 17:37.
Reason: Please insert your example C/C++ codes between [CPP] and [/CPP] tags
|
|||
|
#2
|
|||
|
|||
Re: Compiling multiple files in DevC++Quote:
2. In C++, it's spelled class, not Class 3. You also have a capitalization inconsistency in one use of InklevelPercent. Regards, Dave |
|
#3
|
|||
|
|||
Re: Compiling multiple files in DevC++Thank you Very much
|
|
#4
|
|||
|
|||
Re: Compiling multiple files in DevC++Pen.h
CPP / C++ / C Code:
Main.cpp CPP / C++ / C Code:
Yes, I did include the "#include "Pen.h"" in the main.cpp file Last edited by admin : 06-Sep-2008 at 17:38.
Reason: Please insert your example C/C++ codes between [CPP] and [/CPP] tags
|
|
#5
|
|||
|
|||
Re: Compiling multiple files in DevC++Quote:
Is Pen.h in the same directory as main.cpp? Regards, Dave |
|
#6
|
|||
|
|||
Re: Compiling multiple files in DevC++What do you mean??
|
|
#7
|
|||
|
|||
Re: Compiling multiple files in DevC++Quote:
In what directory is your file "main.cpp"? Is "Pen.h" in that same directory? How did you create the files? How did you save them? Did you create a project in Dev-C++? Did you add both of those files to the project before attempting to compile? Regards, Dave |
|
#8
|
|||
|
|||
Re: Compiling multiple files in DevC++Yes, I did create a project in Dev C++. First, I created the project then I created the files for the projects. Yes, I believe that "Pen.h" is in the same directory.
|
|
#9
|
|||
|
|||
Re: Compiling multiple files in DevC++Now, I'm getting these errrors:
Line 3: In file included from main.cpp Line 11: 'string' does not name a type Line 13: variable or field 'write_on_paper' declared void Line 13: expected ';' before '(' token Line 14: expected unqualified-id before '{' token in function 'int main(int, char**)': Line 15: 'class Pen' has no member named 'Brand' Line 23: 'class Pen' has no member named 'Brand' Line 27: 'class Pen' has no member named 'Brand' Line 29: 'class Pen' has no member named 'write_on_paper' [Build Error] [main.o] Error 1 Pen.h CPP / C++ / C Code:
main.cpp CPP / C++ / C Code:
Last edited by LuciWiz : 08-Sep-2008 at 03:01.
Reason: Please insert your C++ code between [cpp] & [/cpp] tags
|
|
#10
|
|||
|
|||
Re: Compiling multiple files in DevC++Quote:
The Good News: It's now finding your header file. The not-so Good News: There is a little more work to be done. The Good News: It's really minor, once you get familiar with it: At the point in your program where you include Pen.h, the compiler doesn't know what a "string" is, even though you have included <string>. It's a namespace thing. Here's how I would start Pen.h: CPP / C++ / C Code:
In header files, I always give all of the information that they need, so they don't depend on something else having been included in the other file (like <iostream>) This should clear up lots (most? maybe even all???) of the error messages. Try it again. Regards, Dave Footnote: I would also recommend that you use C++ library headers in main.cpp: CPP / C++ / C Code:
I mean, it's not "wrong" to include <stdlib.h>, but the "right way" is with <cstdlib>. |
Recent GIDBlog
Not selected for officer school by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Compiling and linking resource files. Preferably with tcc. | Uten | C Programming Language | 1 | 22-Nov-2007 17:44 |
| Need help for write data into multiple files | sitha | C++ Forum | 8 | 19-Nov-2006 20:05 |
| issues compiling .h and .cpp files with Dev C++ | iceman2006 | C++ Forum | 9 | 17-May-2006 19:32 |
| Bloodshed Dev C++ Project Options | JdS | C++ Forum | 6 | 11-Nov-2005 17:23 |
| controling dialog objects & multiple source files | omills | MS Visual C++ / MFC Forum | 0 | 14-Jul-2004 23:30 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The