Subj : Re: Class problems To : borland.public.cpp.borlandcpp From : Mark Manning/Muniz Eng. Date : Sat Sep 11 2004 10:59 pm Actually, void main( int argc, char *argv[] ) is perfectly valid as long as exit is not used. I misread my printout. So yes - it should be int with the exit command but I should have left off the exit command in my example. According to my book on C++ (as well as the several classes I've written, compiled, and run here at work not to mention the several courses I've had about C++) using void in a deconstructor is ok. You do not have to do that - but it can be done and it will have no bad side effects. Also, I've already tried removing the void within the deconstructor and the error remains. So I know that is not the problem. As for the quip "If you have a problem then post compilable source." If having to change one line in order to make it compile is too much for you then I'd rather wait for someone else to help me. Maybe they will focus on the problem at hand. Now, if you would like me to send you the actual code - I can do that and would be glad to do so. I can just create a zip file and send it to you of the entire directory structure as well as all of the source code files and project file (minus the object files and compiled program). Didn't want to post tons of pages so I posted what I thought (doing a single pass from the printout since I am at work presently) was a reasonable job of transferring the basic problem into this post. But if you would like to see the entire thing - I can send you that as well. Just give me an e-mail address to send it to and then give me about an hour or two because I first have to make it back home. Later. Ed Mulroy [TeamB] wrote: > Start by cleaning up the code. > > The function main returns an int. It does not return void. > > You exit from main with a return statement such as > return 0; > You do NOT exit from main by calling exit. > > C++ functions, including constructors and destructors, that take no > arguments have () and not (void). > > If you have a problem then post compilable source. > > . Ed > > >>Mark Manning/Muniz Eng. wrote in message >>news:4143ab20$1@newsgroups.borland.com... >> >>I recently got the Borland C++v5.02 compiler et al. I've done work >>with C++ for years but the compiler is frustrating me. >> >>I am making a simple "create a name" program for our D&D game and >>I've made a class called "Name". It looks like this: >> >>///////////////////////////////////////////////////////////////// >>enum { gUC, gLC }; // Upper and lowercase ENUMs >>enum { gMale, gFemale ); // Character's gender >> >>class Name >>{ >>private: >> >> >>public: >>Name( void ); >>~Name( void ); >> >>full( void ); // Return the full name. >>human( long optA ); // Create a human name. >>elf( long optA ); // Create an elven name. >>}; >>//////////////////////////////////////////////////////////////// >> >>The main program looks like this: >> >>//////////////////////////////////////////////////////////////// >>#include "main.h" >> >>void >>main( int argc, char *argv[] ) >>{ >>Name myName; >> >>printf( "gUC = %d\n", gUC ); >>myName.human( gMale ); >>printf( "My name is: %s\n", myName.full() ); >>exit( 0 ); >>} >>//////////////////////////////////////////////////////////////// >> >>All of the functions are properly set in name.cpp. Like so: >> >>//////////////////////////////////////////////////////////////// >>#include "main.h" >> >>Name::Name( void ) >>{ >> >>} >> >>Name::~Name( void ) >>{ >>} >> >>Name::full( void ) >>{ >>return( m_full ); >>} >> >>Name::human( long optA ) >>{ >> >>} >> >>Name::elf( long optA ) >>{ >> >>} >>/////////////////////////////////////////////////////////////////// >> >>The "main.h" file contains all of the includes to the various >>classes. >> >>/////////////////////////////////////////////////////////////////// >>#include >>#include >>. >>. >>. >>#include "name.h" >>/////////////////////////////////////////////////////////////////// >> >>Ok! Now that you have all of that information - here is the >>question: >> >>When I compile - it likes everything. But when it reaches the >>linker stage I get: >> >>Undefined Name::~Name() >>Undefined Name::human( long optA ) >>Undefined Name::full() >> >>I've checked all of the functions. I've tried commenting out each >>of the above one after the other - no other error messages are >>coming out of the linker. Also, the first printf statement does not >>give an error about gUC. So I know it is getting name.h loaded. >> >>Why would the linker not like the functions themselves? Also, under >>gcc this compiles without a problem (linux) but Borland C++ v5.02 >>dies. My next plan of attack is to delete and redo the project's >>file. Maybe that is the answer. I recently decided to move >>everything to a separate subfolder (called Character). So maybe the >>project file is messed up somehow. Unknown but if you have an idea >>I'd like to hear from you. (markem@ev1.net). >> >>TIA to anyone who has an idea on this problem. :-) > > > .