| | |
IMPORTANT.. need help asap please!
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Oct 2006
Posts: 8
Reputation:
Solved Threads: 0
ok.. my problem is..
my midterm source code is due tomorw.. unfortunatly i cant get thsi music to play... my group REALLy wants the music and i thin itll boost my chances of an a... when i ran this music in the original(just the music) it runs fine.. when i put it in the iff statement in my code... i get 7000 errors... most complain about mmsystem.h
if i take out the mmsystem.h i get no errors for the most part and it runs like normal.. but no music.,...:cry:
i have left out mmsystem.h in this version.. if u run dev-c++ u have to add linker winlibmm.a using project options>>parameters>> add linker.
my midterm source code is due tomorw.. unfortunatly i cant get thsi music to play... my group REALLy wants the music and i thin itll boost my chances of an a... when i ran this music in the original(just the music) it runs fine.. when i put it in the iff statement in my code... i get 7000 errors... most complain about mmsystem.h
if i take out the mmsystem.h i get no errors for the most part and it runs like normal.. but no music.,...:cry:
i have left out mmsystem.h in this version.. if u run dev-c++ u have to add linker winlibmm.a using project options>>parameters>> add linker.
C++ Syntax (Toggle Plain Text)
#include <iostream.h> #include <iomanip.h> #include <cstdlib> #include <windows.h> using namespace std; int main() { char gender; char option; char race; int hp = 100; int ehp = 100; int str; int intel; int suck = 10; int mp; int armor; int weapon; int armor2; cout << "Please choose your gender(M/F). "; cin >> gender; switch(gender) { case 'm': case 'M': cout << "You have chosen a male character. \n"; cout << "Please choose your class.(Mage,Fighter,Archer.[M,F,A]) "; cin >> race; switch(race) { //start of male race switch case 'm': case 'M': cout << "You have chosen the Mage. "; hp = 75; str = 5; intel = 15; armor = 2; mp = intel * 10; break; case 'f': case 'F': cout << "You have chosen the Fighter. "; hp = 120; str = 15; intel = 5; armor = 5; mp = intel * 10; break; case 'a': case 'A': cout << "You have chosen the Archer. "; hp = 100; str = 10; intel = 10; armor = 3; mp = intel * 10; break; }//end of male race switch break; case 'f': case 'F': cout << "You have chosen a female character.\n "; cout << "Please choose your class.(Mage,Fighter,Archer.[M,F,A]) "; cin >> race; switch(race) {//start of female race switch case 'm': case 'M': cout << "You have chosen the Mage. "; hp = 75; str = 5; intel = 15; armor = 2; mp = intel * 10; break; case 'f': case 'F': cout << "You have chosen the Fighter. "; hp = 120; str = 15; intel = 5; armor = 5; mp = intel * 10; break; case 'a': case 'A': cout << "You have chosen the Archer. "; hp = 100; str = 10; intel = 10; armor = 3; mp = intel * 10; break; }//end of F race switch break; }//end of Gender cout << "Choose your weapon.\n"; cout << "Katana(1). \n"; cout << "Great sword(2). \n"; cout << "Battle Staff(3). \n"; cout << "Silver bow(4). \n"; cout << "Winged Staff(5). \n"; cin >> weapon; switch(weapon) { case 1: cout << "You have chosen the Katana. \n"; str = str + 3; break; case 2: cout << "You have chosen the Great sword. \n"; str = str + 5; armor = armor - 2; break; case 3: cout << "You have chosen the Battle Staff. \n"; str = str + 2; intel = intel - 2; break; case 4: cout << "You have chosen the Silver Bow. \n"; str = str + 2; armor = armor + 2; break; case 5: cout << "You have chosen the Winged Staff. \n"; intel = intel + 4; armor = armor + 1; break; } cout << "Choose your armor.\n"; cout << "Chain armor(1). \n"; cout << "Leather armor(2). \n"; cin >> armor; switch(armor) { case 1: cout << "You have chosen Chain armor.\n"; armor = armor + 4; intel = intel - 2; break; case 2: cout << "You have chosen Leather armor.\n"; armor = armor + 2; break; } cout << "An Oppel attacks! \n \n"; while(ehp > 0 && hp > 0) { cout << "Choose an option. Attack,Magic,Items,Run. \n"; cin >> option; switch(option) { case 'a': case 'A': ehp = ehp - str; hp = hp - (suck - armor); suck++; cout << "Your hp is " << hp << ". \n"; cout << "The Oppel's hp is " << ehp << ". \n"; cout << "Your mp is " << mp << ". \n"; if(ehp < 0) { ehp = 0; } break; case 'm': case 'M': ehp = ehp - intel; hp = hp - (suck - armor); suck++; mp = mp - 10; if(ehp < 0) { ehp = 0; } cout << "Your hp is " << hp << ". \n"; cout << "The Oppel's hp is " << ehp << ". \n"; cout << "Your mp is " << mp << ". \n"; break; case 'i': case 'I': cout << "You have no items! \n"; break; case 'r': case 'R': cout << "You flee the Oppel in shame. \n"; hp = 0; break; } } if(ehp <= 0) { cout << "VICTORY! \n"; cout << "Please wait..."; mciSendString("play E:\ff7vict2.midi",NULL,0,NULL); cout << "\n\nPress Enter to stop ..."; cin.get(); mciSendString("stop E:\ff7vict2.midi",NULL,0,NULL); } if(hp <= 0) { cout << "You have lost. \n"; cout << "GAME OVER!! \n"; } system("PAUSE"); return 0; }
Most likely due to the fact that most of the objects referenced in mmsystem.h are actually defined in winmm.lib -- a library you need to link your program with, or you'll get a ton of errors. In the compiler configuration, look for a list of .libs, then add winmm.lib to the end.
Hope this helps
Hope this helps
"Technological progress is like an axe in the hands of a pathological criminal."
•
•
Join Date: Oct 2006
Posts: 8
Reputation:
Solved Threads: 0
well this code now has mmsystem.h in it BUT still no sounds... strange how i did nothing but add itin today ande im not getting errors frmo yesterday
.
also. programmer isnt adding libwinmm.a thru project options>> parameters the same thing??(dev-C++)
.also. programmer isnt adding libwinmm.a thru project options>> parameters the same thing??(dev-C++)
C++ Syntax (Toggle Plain Text)
#include <iostream.h> #include <iomanip.h> #include <cstdlib> #include <windows.h> #include <mmsystem.h> using namespace std; int main() { char gender; char option; char race; int hp = 100; int ehp = 100; int str; int intel; int suck = 10; int mp; int armor; int weapon; int armor2; cout << "Please choose your gender(M/F). "; cin >> gender; switch(gender) { case 'm': case 'M': cout << "You have chosen a male character. \n"; cout << "Please choose your class.(Mage,Fighter,Archer.[M,F,A]) "; cin >> race; switch(race) { //start of male race switch case 'm': case 'M': cout << "You have chosen the Mage. "; hp = 75; str = 5; intel = 15; armor = 2; mp = intel * 10; break; case 'f': case 'F': cout << "You have chosen the Fighter. "; hp = 120; str = 15; intel = 5; armor = 5; mp = intel * 10; break; case 'a': case 'A': cout << "You have chosen the Archer. "; hp = 100; str = 10; intel = 10; armor = 3; mp = intel * 10; break; }//end of male race switch break; case 'f': case 'F': cout << "You have chosen a female character.\n "; cout << "Please choose your class.(Mage,Fighter,Archer.[M,F,A]) "; cin >> race; switch(race) {//start of female race switch case 'm': case 'M': cout << "You have chosen the Mage. "; hp = 75; str = 5; intel = 15; armor = 2; mp = intel * 10; break; case 'f': case 'F': cout << "You have chosen the Fighter. "; hp = 120; str = 15; intel = 5; armor = 5; mp = intel * 10; break; case 'a': case 'A': cout << "You have chosen the Archer. "; hp = 100; str = 10; intel = 10; armor = 3; mp = intel * 10; break; }//end of F race switch break; }//end of Gender cout << "Choose your weapon.\n"; cout << "Katana(1). \n"; cout << "Great sword(2). \n"; cout << "Battle Staff(3). \n"; cout << "Silver bow(4). \n"; cout << "Winged Staff(5). \n"; cin >> weapon; switch(weapon) { case 1: cout << "You have chosen the Katana. \n"; str = str + 3; break; case 2: cout << "You have chosen the Great sword. \n"; str = str + 5; armor = armor - 2; break; case 3: cout << "You have chosen the Battle Staff. \n"; str = str + 2; intel = intel - 2; break; case 4: cout << "You have chosen the Silver Bow. \n"; str = str + 2; armor = armor + 2; break; case 5: cout << "You have chosen the Winged Staff. \n"; intel = intel + 4; armor = armor + 1; break; } cout << "Choose your armor.\n"; cout << "Chain armor(1). \n"; cout << "Leather armor(2). \n"; cin >> armor; switch(armor) { case 1: cout << "You have chosen Chain armor.\n"; armor = armor + 4; intel = intel - 2; break; case 2: cout << "You have chosen Leather armor.\n"; armor = armor + 2; break; } cout << "An Oppel attacks! \n \n"; while(ehp > 0 && hp > 0) { cout << "Choose an option. Attack,Magic,Items,Run. \n"; cin >> option; switch(option) { case 'a': case 'A': ehp = ehp - str; hp = hp - (suck - armor); suck++; cout << "Your hp is " << hp << ". \n"; cout << "The Oppel's hp is " << ehp << ". \n"; cout << "Your mp is " << mp << ". \n"; if(ehp < 1) { ehp = 0; } break; case 'm': case 'M': ehp = ehp - intel; hp = hp - (suck - armor); suck++; mp = mp - 10; if(ehp < 0) { ehp = 0; } cout << "Your hp is " << hp << ". \n"; cout << "The Oppel's hp is " << ehp << ". \n"; cout << "Your mp is " << mp << ". \n"; break; case 'i': case 'I': cout << "You have no items! \n"; break; case 'r': case 'R': cout << "You flee the Oppel in shame. \n"; hp = 0; break; } } if(ehp <= 0) { cout << "VICTORY! \n"; cout << "Please wait..."; mciSendString("play E:\ff7vict2.mid",NULL,0,NULL); cout << "\n\nPress Enter to stop ..."; cin.get(); mciSendString("stop E:\ff7vict2.mid",NULL,0,NULL); } if(hp <= 0) { cout << "You have lost. \n"; cout << "GAME OVER!! \n"; } system("PAUSE"); return 0; }
> also. programmer isnt adding libwinmm.a thru project options>> parameters the same thing??(dev-C++)
Yes, it is. I didn't mention libwinmm.a as an alternative option to winmm.lib if you're using Dev-C++.
It'll be kind of hard for me to debug your program though, as I'm not on a Windows machine, and I won't be able to compile/run your code. Just a thought, aren't you supposed to run
before you you try to play it. If I'm wrong, sorry because I've never actually used mmsystem.h, I just read that you have to do that in some online guide.
Another thing: in your paths, you're supposed to use double \\s to indicate that it's not an escape charecter! That could be the problem right there.
Yes, it is. I didn't mention libwinmm.a as an alternative option to winmm.lib if you're using Dev-C++.
It'll be kind of hard for me to debug your program though, as I'm not on a Windows machine, and I won't be able to compile/run your code. Just a thought, aren't you supposed to run
C++ Syntax (Toggle Plain Text)
mciSendString("open C:\\path");
Another thing: in your paths, you're supposed to use double \\s to indicate that it's not an escape charecter! That could be the problem right there.
"Technological progress is like an axe in the hands of a pathological criminal."
![]() |
Similar Threads
- important file ccl30.dll missing????? (Viruses, Spyware and other Nasties)
- Help...ASAP (Viruses, Spyware and other Nasties)
- Need x86 assembly programmer ASAP ! (Assembly)
- What is most important? (Monitors, Displays and Video Cards)
- How Important is rundll32.exe? (Windows NT / 2000 / XP)
- Very New to Java and need help converting cubic inches to cm (Java)
- Suse Linux 9.1 Pro Freezes on Startup (*nix Software)
Other Threads in the C++ Forum
- Previous Thread: ClassView is not showing my classes (VC++, namespace, headers) ?!?!?
- Next Thread: bah damn thing doesnt work!
| Thread Tools | Search this Thread |
api array based binary bitmap c++ c/c++ calculator char char* class code coding compile compiler console conversion count database delete deploy desktop developer directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game getline givemetehcodez google graph gui homeworkhelp iamthwee ifstream input int java lib linkedlist linker list loop looping loops map math matrix memory multiple news node number numbertoword output pointer problem program programming project proxy python random read recursion recursive reference rpg sorting string strings temperature template test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






