| View previous topic :: View next topic |
| Author |
Message |
Cloud-Strife Master Cheater
Reputation: 0
Joined: 14 Mar 2008 Posts: 346 Location: MilkyWay
|
Posted: Wed Jan 07, 2009 7:59 pm Post subject: C++ Code compiling |
|
|
I have MinGW-5.1.4 which is a C/C++ compiler and I also have this code which I need to compile in order to run the program. Any idea how to do this?
Original code link : http://forum.swiftirc.net/viewtopic.php?t=4582
_________________
|
|
| Back to top |
|
 |
BirdsEye Advanced Cheater
Reputation: 0
Joined: 05 Apr 2008 Posts: 94
|
Posted: Wed Jan 07, 2009 8:08 pm Post subject: |
|
|
| Uhh... It's all right there... you just need to copy and paste. Obviously you'd copy the functions before the entry point and then the main code itself. (I would have understanded .001% if there was no implementation example, but this is wow... its all right in front of you)
|
|
| Back to top |
|
 |
Cloud-Strife Master Cheater
Reputation: 0
Joined: 14 Mar 2008 Posts: 346 Location: MilkyWay
|
Posted: Thu Jan 08, 2009 3:15 pm Post subject: |
|
|
| BirdsEye wrote: | | Uhh... It's all right there... you just need to copy and paste. Obviously you'd copy the functions before the entry point and then the main code itself. (I would have understanded .001% if there was no implementation example, but this is wow... its all right in front of you) |
The question is where do I freaking paste it?
_________________
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Thu Jan 08, 2009 3:49 pm Post subject: |
|
|
get an IDE like visual studio, or...
just paste it in a text file, change the extension, pass it to the compiler, and link it.
|
|
| Back to top |
|
 |
Cloud-Strife Master Cheater
Reputation: 0
Joined: 14 Mar 2008 Posts: 346 Location: MilkyWay
|
Posted: Thu Jan 08, 2009 4:08 pm Post subject: |
|
|
| slovach wrote: | get an IDE like visual studio, or...
just paste it in a text file, change the extension, pass it to the compiler, and link it. |
Change the extension to what...
And how do I pass it to the compiler >.>;
_________________
|
|
| Back to top |
|
 |
blackmorpheus Expert Cheater
Reputation: 0
Joined: 05 Apr 2008 Posts: 159
|
Posted: Thu Jan 08, 2009 4:33 pm Post subject: |
|
|
You are such a freaking idiot. GO fucking look it up on google i mean, come on, use you own fkin brain some time.
Anyway, I am a very nice guy so i looked it up for ya,
Its all in here:
http ://csjava.occ.cccd.edu/~gilberts/mingw/
Anyway, if this is too hard for ya, you might wanna try Visual Studio 2008 Express, its free and it's easy to use.
|
|
| Back to top |
|
 |
Cloud-Strife Master Cheater
Reputation: 0
Joined: 14 Mar 2008 Posts: 346 Location: MilkyWay
|
Posted: Thu Jan 08, 2009 6:03 pm Post subject: |
|
|
| blackmorpheus wrote: | You are such a freaking idiot. GO fucking look it up on google i mean, come on, use you own fkin brain some time.
Anyway, I am a very nice guy so i looked it up for ya,
Its all in here:
http ://csjava.occ.cccd.edu/~gilberts/mingw/
Anyway, if this is too hard for ya, you might wanna try Visual Studio 2008 Express, its free and it's easy to use. |
I am an idiot for asking?
Hmm...I get a stream of errors when I put in the command "g++ combatcalc.cpp -o combatcalc.exe"
Then I tried "g++ combatclass.cpp combatcalc.cpp -o combatcalc.exe"
Still get the errors...
Something wrong with the code?
Edit: Posted a screenie of the errors
_________________
|
|
| Back to top |
|
 |
manc Grandmaster Cheater
Reputation: 1
Joined: 16 Jun 2006 Posts: 551
|
Posted: Thu Jan 08, 2009 11:30 pm Post subject: |
|
|
Alright lets see how do I put this...
You wunna copy the code they gave you. Now i know this sounds complicated but we'll take it step by step. Press the left button on your mouse and DRAG it to highlight the words you want copied. Got it? Ok good. Now press ctrl + c. Yes. You have to hold ctrl, and press c. I know this sounds hard but stick with it we are almost there. Here comes the hard part, download a compiler (MSVC++ 2008 Express, GNC, Dev, Borland, etc). Go to file-->new and select new project or new C++ file or new .cpp file. In the white area that you can type, you PASTE the code (Accomplished by pressing Ctrl+V). Look where the code goes here (http://i34.tinypic.com/ehek5j.jpg) Oh, to view that, you have to click on the highlighted blue part. I am hope I am not making this too difficult for you. Then, look for the build/compile button somewhere within the program, it is there, I promise . Congratulations...you are now an accomplished coder....
tl;dr http://justfuckinggoogleit.com/
Alright I'll cut the bullshit though....you dont need to use command prompt. Just look for the compile button in your compile (may also be called build, usually paired with run)
_________________
|
|
| Back to top |
|
 |
sloppy Expert Cheater
Reputation: 0
Joined: 17 Aug 2008 Posts: 123
|
Posted: Fri Jan 09, 2009 12:14 am Post subject: |
|
|
| JVlania wrote: | Something wrong with the code?
Edit: Posted a screenie of the errors
 |
| Code: | #include <iostream>
#include <string>
using namespace std; |
^ Add to the top of your cpp file.
|
|
| Back to top |
|
 |
Cloud-Strife Master Cheater
Reputation: 0
Joined: 14 Mar 2008 Posts: 346 Location: MilkyWay
|
Posted: Fri Jan 09, 2009 4:09 pm Post subject: |
|
|
There is no compile button in my compiler. It is just a bunch of files and .exes for CMD.exe
My PATH settings are correct too : c:\minigw\bin
And I added | Code: | #include <iostream>
#include <string>
#include "combatclass.cpp"
using namespace std;
void err (float eprob);
int main() |
Before my code and now the new error line I get is this:
combatcalc.cpp:10: error: expected initializer before "double"
I tried googling for 30+mins before I posted my problems .
Any help on new error?
Full code looks like this:
| Code: | #include <iostream>
#include <string>
#include "combatclass.cpp"
using namespace std;
void err (float eprob);
int main()
double getCombat(double att, double str, double def, double hp, double mage, double range, double pray) {
string combat_class;
double cmblvl = (0.32707 * att) + (0.249 * def) + (0.324 * str) + (0.25 * hp) + (0.124 * pray);
double rangelvl = (0.487 * range) + (0.249 * def) + (0.25 * hp) + (0.124 * pray);
double magelvl = (0.487 * mage) + (0.249 * def) + (0.25 * hp) + (0.124 * pray);
if ((cmblvl > magelvl) && (cmblvl > rangelvl)) {
combat_class = "Warrior";
}
else if ((rangelvl > magelvl) && (rangelvl > cmblvl)) {
combat_class = "Ranger";
cmblvl = rangelvl;
}
else if ((magelvl > cmblvl) && (magelvl > rangelvl)) {
combat_class = "Mage";
cmblvl = magelvl;
}
else {
combat_class = "Warrior";
}
return(cmblvl);
}
|
_________________
|
|
| Back to top |
|
 |
&Vage Grandmaster Cheater Supreme
Reputation: 0
Joined: 25 Jul 2008 Posts: 1053
|
Posted: Fri Jan 09, 2009 4:51 pm Post subject: |
|
|
Missing brackets for int main
| Code: |
int main() -> int main(){
|
|
|
| Back to top |
|
 |
blackmorpheus Expert Cheater
Reputation: 0
Joined: 05 Apr 2008 Posts: 159
|
Posted: Fri Jan 09, 2009 5:04 pm Post subject: |
|
|
Sorry, I overreacted a little bit.
But i still think it's easier to use Visual C++...
Visual studio automatically does all this stuff for you...
You can download Visual C++ Express for free.
|
|
| Back to top |
|
 |
Cloud-Strife Master Cheater
Reputation: 0
Joined: 14 Mar 2008 Posts: 346 Location: MilkyWay
|
Posted: Fri Jan 09, 2009 5:17 pm Post subject: |
|
|
| _void_ wrote: | Missing brackets for int main
| Code: |
int main() -> int main(){
|
|
That just gives me more errors.
_________________
|
|
| Back to top |
|
 |
smartz993 I post too much
Reputation: 2
Joined: 20 Jun 2006 Posts: 2013 Location: USA
|
Posted: Fri Jan 09, 2009 5:18 pm Post subject: |
|
|
| _void_ wrote: | Missing brackets for int main
| Code: |
int main() -> int main(){
|
|
No. There is no code in his int main function. That whole thing there is the getCombat function.
|
|
| Back to top |
|
 |
blackmorpheus Expert Cheater
Reputation: 0
Joined: 05 Apr 2008 Posts: 159
|
Posted: Fri Jan 09, 2009 5:30 pm Post subject: |
|
|
if there is nothing in his main function, nothing is gonna happen right???
you should add return 0;} at the end I think
|
|
| Back to top |
|
 |
|