Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


C++ Code compiling
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Cloud-Strife
Master Cheater
Reputation: 0

Joined: 14 Mar 2008
Posts: 346
Location: MilkyWay

PostPosted: Wed Jan 07, 2009 7:59 pm    Post subject: C++ Code compiling Reply with quote

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
View user's profile Send private message MSN Messenger
BirdsEye
Advanced Cheater
Reputation: 0

Joined: 05 Apr 2008
Posts: 94

PostPosted: Wed Jan 07, 2009 8:08 pm    Post subject: Reply with quote

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
View user's profile Send private message
Cloud-Strife
Master Cheater
Reputation: 0

Joined: 14 Mar 2008
Posts: 346
Location: MilkyWay

PostPosted: Thu Jan 08, 2009 3:15 pm    Post subject: Reply with quote

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? Rolling Eyes

_________________
Back to top
View user's profile Send private message MSN Messenger
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Thu Jan 08, 2009 3:49 pm    Post subject: Reply with quote

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
View user's profile Send private message
Cloud-Strife
Master Cheater
Reputation: 0

Joined: 14 Mar 2008
Posts: 346
Location: MilkyWay

PostPosted: Thu Jan 08, 2009 4:08 pm    Post subject: Reply with quote

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 >.>; Confused

_________________
Back to top
View user's profile Send private message MSN Messenger
blackmorpheus
Expert Cheater
Reputation: 0

Joined: 05 Apr 2008
Posts: 159

PostPosted: Thu Jan 08, 2009 4:33 pm    Post subject: Reply with quote

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
View user's profile Send private message
Cloud-Strife
Master Cheater
Reputation: 0

Joined: 14 Mar 2008
Posts: 346
Location: MilkyWay

PostPosted: Thu Jan 08, 2009 6:03 pm    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
manc
Grandmaster Cheater
Reputation: 1

Joined: 16 Jun 2006
Posts: 551

PostPosted: Thu Jan 08, 2009 11:30 pm    Post subject: Reply with quote

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? Razz 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 Sad . Congratulations...you are now an accomplished coder.... Wink

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
View user's profile Send private message
sloppy
Expert Cheater
Reputation: 0

Joined: 17 Aug 2008
Posts: 123

PostPosted: Fri Jan 09, 2009 12:14 am    Post subject: Reply with quote

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
View user's profile Send private message
Cloud-Strife
Master Cheater
Reputation: 0

Joined: 14 Mar 2008
Posts: 346
Location: MilkyWay

PostPosted: Fri Jan 09, 2009 4:09 pm    Post subject: Reply with quote

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 Rolling Eyes .

Any help on new error? Shocked

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
View user's profile Send private message MSN Messenger
&Vage
Grandmaster Cheater Supreme
Reputation: 0

Joined: 25 Jul 2008
Posts: 1053

PostPosted: Fri Jan 09, 2009 4:51 pm    Post subject: Reply with quote

Missing brackets for int main

Code:

int main()  -> int main(){
Back to top
View user's profile Send private message
blackmorpheus
Expert Cheater
Reputation: 0

Joined: 05 Apr 2008
Posts: 159

PostPosted: Fri Jan 09, 2009 5:04 pm    Post subject: Reply with quote

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
View user's profile Send private message
Cloud-Strife
Master Cheater
Reputation: 0

Joined: 14 Mar 2008
Posts: 346
Location: MilkyWay

PostPosted: Fri Jan 09, 2009 5:17 pm    Post subject: Reply with quote

_void_ wrote:
Missing brackets for int main

Code:

int main()  -> int main(){


That just gives me more errors.

_________________
Back to top
View user's profile Send private message MSN Messenger
smartz993
I post too much
Reputation: 2

Joined: 20 Jun 2006
Posts: 2013
Location: USA

PostPosted: Fri Jan 09, 2009 5:18 pm    Post subject: Reply with quote

_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
View user's profile Send private message
blackmorpheus
Expert Cheater
Reputation: 0

Joined: 05 Apr 2008
Posts: 159

PostPosted: Fri Jan 09, 2009 5:30 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites