#iclude problems
-
hello to list any assistance much appreciated. i apologise if this message loads slowly (received a warning when i sent). i live way out back, very slow connection, and i get email longer than this no problem) why did the one project i did compile include syntax different to the text book example? (staugaard, jr. structured and object oriented techniques, 2nd edition) using borland 5.5.1 free command line tools with a command promt screen setup for me be a student list advisor so i type in 'complink to compile. i don't want to bother him further on this matter. couldn't figure out how to get a project to compile with borland 4.5, but have succedded in getting one to run with 5.5.1. i thought all i would have to do is use the same #include, #endif, etc, and all would be well. i think the enum is wrecking things in some small part, i can't find any information to show me rules for using enum's in structs. this code is probably a bit cut up by now. you may have to fix the word wrap you may assume i am rather green at this /* *************************************** */ /* Yahtzee header file: */ #ifndef YATZ_H #define YATZ_H struct Play { private: public: int Score[ScoreMax+1]; int Dice[DiceMax+1]; void DisplayScoreCat(ScoreCat Cat); void DisplayDice(); void Throw(); void Initialise(); }; #endif /* *****************************************8 */ /* main file */ #include #include #include #include using namespace std; #include "Yahzt.h" const int ScoreMax=17; const int DiceMax=5; int main() { enum ScoreCat {Ones, Twos, Threes, Fours, Fives, Sixes, Three_of_a_Kind, Four_of_a_Kind, Full_House, Small_Straight, Large_Straight, Yahtzee, Chance, Bonus, Upper_Total, Lower_Total, Grand_Total}; ScoreCat Cat; Play Game; // declare Game object Game.Initialise(); time_t t; srand((unsigned) time(&t)); cout<<"\n\n\t\tYatsee Game " <<"\t\tScoring Catagories \n\n"; for(Cat = Ones; Cat <= Full_House; Cat =(ScoreCat) (Cat+1)) { cout<<"\t\t"<<(Cat+1); Game.DisplayScoreCat(Cat); cout<<"-"<
-
hello to list any assistance much appreciated. i apologise if this message loads slowly (received a warning when i sent). i live way out back, very slow connection, and i get email longer than this no problem) why did the one project i did compile include syntax different to the text book example? (staugaard, jr. structured and object oriented techniques, 2nd edition) using borland 5.5.1 free command line tools with a command promt screen setup for me be a student list advisor so i type in 'complink to compile. i don't want to bother him further on this matter. couldn't figure out how to get a project to compile with borland 4.5, but have succedded in getting one to run with 5.5.1. i thought all i would have to do is use the same #include, #endif, etc, and all would be well. i think the enum is wrecking things in some small part, i can't find any information to show me rules for using enum's in structs. this code is probably a bit cut up by now. you may have to fix the word wrap you may assume i am rather green at this /* *************************************** */ /* Yahtzee header file: */ #ifndef YATZ_H #define YATZ_H struct Play { private: public: int Score[ScoreMax+1]; int Dice[DiceMax+1]; void DisplayScoreCat(ScoreCat Cat); void DisplayDice(); void Throw(); void Initialise(); }; #endif /* *****************************************8 */ /* main file */ #include #include #include #include using namespace std; #include "Yahzt.h" const int ScoreMax=17; const int DiceMax=5; int main() { enum ScoreCat {Ones, Twos, Threes, Fours, Fives, Sixes, Three_of_a_Kind, Four_of_a_Kind, Full_House, Small_Straight, Large_Straight, Yahtzee, Chance, Bonus, Upper_Total, Lower_Total, Grand_Total}; ScoreCat Cat; Play Game; // declare Game object Game.Initialise(); time_t t; srand((unsigned) time(&t)); cout<<"\n\n\t\tYatsee Game " <<"\t\tScoring Catagories \n\n"; for(Cat = Ones; Cat <= Full_House; Cat =(ScoreCat) (Cat+1)) { cout<<"\t\t"<<(Cat+1); Game.DisplayScoreCat(Cat); cout<<"-"<
mehere wrote: Error E2209 Yahtzmain.cpp 12: Unable to open include file 'Yahzt.h' Something is rotten with your include-path: the compiler does not find the header file to include. He is probably not searching the Dir where it sits. Correct that and most (any?) of the errors are fixed. The compiler ( being supid as toast but a workaholic;) ) tries to interprete the rest of your code anyway, and fails.
My opinions may have changed, but not the fact that I am right.
-
hello to list any assistance much appreciated. i apologise if this message loads slowly (received a warning when i sent). i live way out back, very slow connection, and i get email longer than this no problem) why did the one project i did compile include syntax different to the text book example? (staugaard, jr. structured and object oriented techniques, 2nd edition) using borland 5.5.1 free command line tools with a command promt screen setup for me be a student list advisor so i type in 'complink to compile. i don't want to bother him further on this matter. couldn't figure out how to get a project to compile with borland 4.5, but have succedded in getting one to run with 5.5.1. i thought all i would have to do is use the same #include, #endif, etc, and all would be well. i think the enum is wrecking things in some small part, i can't find any information to show me rules for using enum's in structs. this code is probably a bit cut up by now. you may have to fix the word wrap you may assume i am rather green at this /* *************************************** */ /* Yahtzee header file: */ #ifndef YATZ_H #define YATZ_H struct Play { private: public: int Score[ScoreMax+1]; int Dice[DiceMax+1]; void DisplayScoreCat(ScoreCat Cat); void DisplayDice(); void Throw(); void Initialise(); }; #endif /* *****************************************8 */ /* main file */ #include #include #include #include using namespace std; #include "Yahzt.h" const int ScoreMax=17; const int DiceMax=5; int main() { enum ScoreCat {Ones, Twos, Threes, Fours, Fives, Sixes, Three_of_a_Kind, Four_of_a_Kind, Full_House, Small_Straight, Large_Straight, Yahtzee, Chance, Bonus, Upper_Total, Lower_Total, Grand_Total}; ScoreCat Cat; Play Game; // declare Game object Game.Initialise(); time_t t; srand((unsigned) time(&t)); cout<<"\n\n\t\tYatsee Game " <<"\t\tScoring Catagories \n\n"; for(Cat = Ones; Cat <= Full_House; Cat =(ScoreCat) (Cat+1)) { cout<<"\t\t"<<(Cat+1); Game.DisplayScoreCat(Cat); cout<<"-"<
mehere wrote: Error E2209 Yahtzmain.cpp 12: Unable to open include file 'Yahzt.h' I know it sounds silly, but are you sure your file is named 'Yahzt.h'? I once mistyped the filename for a class. I wanted to include the headerfile but it wasn't found. After half an hour searching for the error I checked filenames and found the problem :-O -- karl
-
mehere wrote: Error E2209 Yahtzmain.cpp 12: Unable to open include file 'Yahzt.h' I know it sounds silly, but are you sure your file is named 'Yahzt.h'? I once mistyped the filename for a class. I wanted to include the headerfile but it wasn't found. After half an hour searching for the error I checked filenames and found the problem :-O -- karl
thanks to all for replies. only as i was checking through text afer posting did i notice mis-spelt header file. felt dumb. found an example which showed me to locate enum and constants above struct in header, thats a relief. now get errors: Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland Yahtzmain.cpp: Error E2206 Yahtz.h 1: Illegal character 'ÿ' (0xff) Error E2206 Yahtz.h 1: Illegal character 'þ' (0xfe) Error E2040 Yahtz.h 1: Declaration terminated incorrectly Error E2206 Yahtz.h 1: Illegal character '' (0x0) Error E2206 Yahtz.h 1: Illegal character '' (0x0) '' '' '' '' '' '' (to bottom of screen) Error E2228 Yahtz.h 13: Too many error or warning messages *** 26 errors in Compile *** new header file is: /* header file */ #ifndef YATZ_H #define YATZ_H const int ScoreMax=17; const int DiceMax=5; enum ScoreCat {Ones,Twos,Threes,Fours,Fives,Sixes, Three_of_a_Kind,Four_of_a_Kind,Full_House, Small_Straight,Large_Straight, Yahtzee, Chance, Bonus, Upper_Total, Lower_Total,Grand_Total}; struct Play { private: public: int Score[ScoreMax+1]; int Dice[DiceMax+1]; void DisplayScoreCat(ScoreCat Cat); void DisplayDice(); void Throw(); void Initialise(); }; #endif /* ****************************** */ error mesages from borland 4.5 for same code : Linking yahtzee.exe: linker Warning: No module definition file specified: using defaults Linker Error: Play::DisplayScoreCat(ScoreCat) defined in module YAHTZMAIN.CPP is duplicated in module YAHTZ.CPP /* **************** */ these 5 linker messages continue for all functions. i am giving up and getting on with conceptual foundations study. thanks again kirk