![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#11 |
|
Programmer
Join Date: Dec 2004
Posts: 34
Rep Power: 0
![]() |
Ok,.. how did u compile it?
I did it like this. 1) Copy and pasted the code as it is in parts, and saved it as mentioned above. (ListType.h, listTypeImp.cpp, test.cpp) 2) Saved those files in a folder. 3) Then opened the file test.cpp in BORLAND and pressed the compile button. That is it. and then ofcourse got an error. |
|
|
|
|
|
#12 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Consider for a moment that you have more than one source file. Believe it or not, housing them in the same directory does not magically cause your compiler to know that you want them to be part of the final executable. Make a console project and add all three files to it. Use your help documentation or farble around; time to break some sweat here. Once they are specified as forming a project, build the project. When you've got a little time for a break, research the steps that are necessary to get from textual code files to a running executable. Preprocessing, compiling, linking, blah blah blah. Relying on your prof seems problematic.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#13 |
|
Troll
Join Date: Apr 2005
Location: Texas
Posts: 732
Rep Power: 4
![]() |
0xcafedead eh? I stick by 0xdeadbeef.
Wouldn't that imply that either a pointer somewhere has been specifically set to 0xcafedead as a debugging aid? In Wine (which is not an emulator, by the way) any not-implemented functions are fixed-up to 0xdeadbeef. That way, a crash relating directly to a non-implemented function is easy to discern from something more sinister. Just a thought. Any compiler/linker errors/warnings?
__________________
MD5(sig) = bcef75433db02e9ad9bf81d6f7c5c270 |
|
|
|
|
|
#14 |
|
Programmer
Join Date: Dec 2004
Posts: 34
Rep Power: 0
![]() |
OK thank you guys for encouragement,.. I got the answer.
Special Thanks DaWei, your console project method worked. I had to study for it but in the end i think 15 minutes were worth the trouble. I think u will see more posts from me in the future,..lol |
|
|
|
|
|
#15 |
|
Hobbyist Programmer
Join Date: Jan 2006
Location: UK
Posts: 215
Rep Power: 3
![]() |
I know DaWei thats why I had just kidding at the end of my post. Makes me wonder about some of these CS lecturers who teach stuff like this :/
|
|
|
|
|
|
#16 | |
|
Caffeinated Neural Net
![]() Join Date: Jun 2005
Location: Dry west coast of Canada
Posts: 1,031
Rep Power: 5
![]() |
Quote:
__________________
And once again, Probability proves itself willing to sneak into a back alley and service Drama as would a copper-piece harlot. - Vaarsuvius, Order of the Stick |
|
|
|
|
|
|
#17 |
|
Programming Guru
![]() Join Date: Oct 2004
Location: namespace std
Posts: 1,246
Rep Power: 5
![]() |
you also employed information hiding in your post by hiding the code somewhere else. i have dial-up, i'm not gonna click on that shit.
anyway, when i use information hiding i typically have my compiler count to 100 while i hide the code in a cardboard box. once i hid a private member function under my porch and gcc didn't find it for three days, then i let vs have a try at it. it was a jolly old time.
__________________
i put on my robe and wizard hat... Have you ever heard of Plato, Aristotle, Socrates?...Morons. |
|
|
|
|
|
#18 |
|
Programmer
Join Date: Dec 2004
Posts: 34
Rep Power: 0
![]() |
Lets say that I have to make a derived class from the above mentioned one.
Do I just add to the current project console the new .h and .cpp files or is there some other way? |
|
|
|
|
|
#19 | |
|
Caffeinated Neural Net
![]() Join Date: Jun 2005
Location: Dry west coast of Canada
Posts: 1,031
Rep Power: 5
![]() |
Quote:
Remember, the 'project' is merely a set of rules (compiler/linker options, and so on) to use when building your program, and a list of files to use (source, object, and library). You shouldn't need to add your header files to the project, as they are #included by your code, but you will need to add your C++ source files.
__________________
And once again, Probability proves itself willing to sneak into a back alley and service Drama as would a copper-piece harlot. - Vaarsuvius, Order of the Stick |
|
|
|
|
|
|
#20 |
|
Programmer
Join Date: Dec 2004
Posts: 34
Rep Power: 0
![]() |
Let me give an example of what i am doing:
The base class is called Two_Dimensions. I have included three files in this project namely: 1) Two_Diemensions_Header.h (Contains header file) 2) Two_Diemensions_Main.cpp (The MAIN function) 3) Two_Diemensions_Imp.cpp (The Implememtation of the class Function) Now I need to create a new derived class called Rectangle, which takes the Two_Dimensions from the above (length and width) class, adds a new variable Height to it and then display various things like Area, paramenter etc,. So, do it just add the three files (Rectangle_Header.h, Rectangle_Main.cpp, Rectangle_Imp.cpp) to the Two_Diemension project that already exists or do i make a new project and add the Two_Dimension Header and Implementation file only and the entire Derived Class Rectangle. In SHORT The first false would include one project with Six Files: 1) Two_Dimensions_Header.h 2) Two_Dimensions_Imp.cpp 3) Two_Dimensions_MAIN.cpp 4) Triangle_Header.h 5) Triangle_Imp.CPP 6) Triangle_MAIN.CPP The second case would be that I make a new Project called Rectangle and ADD only TWO Files from the Base Class Two_Dimensions. Overall the project would contain the following files: 1) Two_Dimensions_Header.h 2) Two_Dimensions_Imp.cpp 3) Triangle_Header.h 4) Triangle_Imp.CPP 5) Triangle_MAIN.CPP NOTE: No main function for Two_Dimensions. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|