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 


My program works fine in Visual C++ but...

 
Post new topic   This topic is locked: you cannot edit posts or make replies.    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Chase Payne
Grandmaster Cheater
Reputation: 1

Joined: 20 Mar 2008
Posts: 533

PostPosted: Tue Nov 02, 2010 4:30 pm    Post subject: My program works fine in Visual C++ but... Reply with quote

When it's compiled standalone, it doesn't work?
//Header File
Code:

#include <string.h>
#include <iostream>
#include <string>
#include <Windows.h>
using namespace std;
int *entryv;
int *negentry;
int source1;
int source2;
double source3[100];
int *total[255];
int miss[255];
double *lime;
double lemons;
int g = 0;
double f = 1;
double *bugtotal[100];
string password = "lemons";

void check()
{
   string entry;
   cin >> entry;
   if(password.compare(entry) != 0)
   {
      cout << "Invalidation.\n";
      while(password.compare(entry) != 0)
      {
         cout << "\nPlease try again.\n";
         cin >> entry;
      }
   }
    SetConsoleTitle(_T("Point Calculation v4.0"));
}




Code:
#include "stdafx.h"
#include <iostream>
#include "encrytion.h"
#include <string>
using namespace std;
#include <windows.h>



double calculation()
{
   f = *lime;
   for(int e = 0; e < 60; e++)
   {
    *bugtotal[e] = f / *lime;
   cout << f << "/" << *lime << "=" << *bugtotal[e] << endl;
   f--;
   if(*bugtotal[e] < 0.86)
   {
      cout << "Finished Calculating, you will fail after missing " << e << " problems.";
      break;
   }
   }   
   return 0;
}
int main()
{
  SetConsoleTitle(_T("String Compare"));
  entryv = &source1;
  negentry = &source2;
  lime = &lemons;
  cout << "This program is a string compare test, in order for you to continue you need to enter in the correct password.\n";
  check();
  for(int x = 0; x < 100; x++)
  {
     bugtotal[x] = &source3[x];
  }
  cout << "Insert your points here, then seperate them with return key. To terminate loop, enter a negative number.\n";
for (int e = 0; e < 60; e++)
{
  cin >> *entryv;
if(*entryv < 0)
{
cout << "The total is:" << *lime << endl;
break;
}
*lime =  *entryv + *lime;

}
calculation();
}


What happens is, when executed stand alone after building; after the add loop the program closes showing this in debugger mode.

Quote:
'Point Calculation.exe': Loaded 'C:\Windows\SysWOW64\ntdll.dll', Cannot find or open the PDB file
'Point Calculation.exe': Loaded 'C:\Windows\SysWOW64\kernel32.dll', Cannot find or open the PDB file
'Point Calculation.exe': Loaded 'C:\Windows\SysWOW64\KernelBase.dll', Cannot find or open the PDB file
'Point Calculation.exe': Loaded 'C:\Windows\SysWOW64\msvcp100d.dll', Symbols loaded.
'Point Calculation.exe': Loaded 'C:\Windows\SysWOW64\msvcr100d.dll', Symbols loaded.
The program '[3496] Point Calculation.exe: Native' has exited with code 0 (0x0).



However, whenever the code is executed by control+f5 and not stand alone, the code works.
Back to top
View user's profile Send private message
Noz3001
I'm a spammer
Reputation: 26

Joined: 29 May 2006
Posts: 6220
Location: /dev/null

PostPosted: Tue Nov 02, 2010 5:03 pm    Post subject: Reply with quote

The debugger is trying to load symbols from them libraries. Do you REALLY need to include windows.h JUST for SetConsoleTitle? Neutral
Back to top
View user's profile Send private message MSN Messenger
Chase Payne
Grandmaster Cheater
Reputation: 1

Joined: 20 Mar 2008
Posts: 533

PostPosted: Tue Nov 02, 2010 5:22 pm    Post subject: Reply with quote

It's fine, it turns out that I forgot system("pause");
Back to top
View user's profile Send private message
Noz3001
I'm a spammer
Reputation: 26

Joined: 29 May 2006
Posts: 6220
Location: /dev/null

PostPosted: Tue Nov 02, 2010 5:27 pm    Post subject: Reply with quote

Chase Payne wrote:
It's fine, it turns out that I forgot system("pause");


That's not fine at all. Where are you learning this crap?
Back to top
View user's profile Send private message MSN Messenger
Chase Payne
Grandmaster Cheater
Reputation: 1

Joined: 20 Mar 2008
Posts: 533

PostPosted: Tue Nov 02, 2010 6:53 pm    Post subject: Reply with quote

SexualisedLanguage wrote:
Chase Payne wrote:
It's fine, it turns out that I forgot system("pause");


That's not fine at all. Where are you learning this crap?

Well besides the set console title and strings part, from the dummies books.

The array + pointers is something I prefer to do, even though theres probably a much easier way.

The program works, no need to fuss about it. It get's the job done.


If you are wondering, I'm under an education where I cannot get lower than a 86% or it converts to a automatic F.
Back to top
View user's profile Send private message
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Tue Nov 02, 2010 7:38 pm    Post subject: Reply with quote

Quote:

If you are wondering, I'm under an education where I cannot get lower than a 86% or it converts to a automatic F.


Well then I hope that you would understand that coding something subpar or using poor practices would lead to an "automatic F". Efficiency should be key. Although it may not matter in this program, in large scale programs / small scale embedded stuff it WOULD matter

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

Joined: 29 May 2006
Posts: 6220
Location: /dev/null

PostPosted: Tue Nov 02, 2010 8:00 pm    Post subject: Reply with quote

Remove 2 lines of terrible code and it'll run on any platform with g++. This is just windows
Back to top
View user's profile Send private message MSN Messenger
Chase Payne
Grandmaster Cheater
Reputation: 1

Joined: 20 Mar 2008
Posts: 533

PostPosted: Tue Nov 02, 2010 8:27 pm    Post subject: Reply with quote

SexualisedLanguage wrote:
Remove 2 lines of terrible code and it'll run on any platform with g++. This is just windows

I am aware it wont run anything but windows; neither do I care.

There's no advantage of me going to anything under windows 7.

You're already crippling yourself if you go to another OS, if you are a gamer of course.

I know there is no need for a console title change, but to be honest I've only read 7 chapters in C++.

C# I believe can only be ran on windows, yet many people prefer it.
( Regarding buggy emulation)
Back to top
View user's profile Send private message
Noz3001
I'm a spammer
Reputation: 26

Joined: 29 May 2006
Posts: 6220
Location: /dev/null

PostPosted: Tue Nov 02, 2010 8:50 pm    Post subject: Reply with quote

Chase Payne wrote:
SexualisedLanguage wrote:
Remove 2 lines of terrible code and it'll run on any platform with g++. This is just windows

I am aware it wont run anything but windows; neither do I care.

There's no advantage of me going to anything under windows 7.

You're already crippling yourself if you go to another OS, if you are a gamer of course.

I know there is no need for a console title change, but to be honest I've only read 7 chapters in C++.

C# I believe can only be ran on windows, yet many people prefer it.
( Regarding buggy emulation)


It's a shame most developers are this retarded. Also, C# can be compiled to run on Linux too.
Back to top
View user's profile Send private message MSN Messenger
Chase Payne
Grandmaster Cheater
Reputation: 1

Joined: 20 Mar 2008
Posts: 533

PostPosted: Tue Nov 02, 2010 9:07 pm    Post subject: Reply with quote

SexualisedLanguage wrote:
Chase Payne wrote:
SexualisedLanguage wrote:
Remove 2 lines of terrible code and it'll run on any platform with g++. This is just windows

I am aware it wont run anything but windows; neither do I care.

There's no advantage of me going to anything under windows 7.

You're already crippling yourself if you go to another OS, if you are a gamer of course.

I know there is no need for a console title change, but to be honest I've only read 7 chapters in C++.

C# I believe can only be ran on windows, yet many people prefer it.
( Regarding buggy emulation)


It's a shame most developers are this retarded. Also, C# can be compiled to run on Linux too.

Because I restricted the console application to run only on a Windows Machine makes me retarded? Really? I'm *NEVER* going to a different OS, and the main reason is windows is much more compatible.

If I actually planned on distributing it, I would obviously remove the code that makes it restricted to windows only.

I Used to run C# bots in games that where 100% incompatible with macs, even with the .net emulation. So obviously, not all c# can be ran.

(I'm sure if it was something as simple as proving new offsets for the mac client they would have done it.)
Back to top
View user's profile Send private message
Noz3001
I'm a spammer
Reputation: 26

Joined: 29 May 2006
Posts: 6220
Location: /dev/null

PostPosted: Tue Nov 02, 2010 9:27 pm    Post subject: Reply with quote

Chase Payne wrote:
I Used to run C# bots in games that where 100% incompatible with macs, even with the .net emulation. So obviously, not all c# can be ran.


I didn't mention mac. Windows is not more compatible. If you planned on distributing it, why would you use windows API to begin with?

Quote:
Because I restricted the console application to run only on a Windows Machine makes me retarded? Really?


Yes, because it was 2 lines which could have easily been avoided.
Back to top
View user's profile Send private message MSN Messenger
Chase Payne
Grandmaster Cheater
Reputation: 1

Joined: 20 Mar 2008
Posts: 533

PostPosted: Tue Nov 02, 2010 9:44 pm    Post subject: Reply with quote

SexualisedLanguage wrote:
Chase Payne wrote:
I Used to run C# bots in games that where 100% incompatible with macs, even with the .net emulation. So obviously, not all c# can be ran.


I didn't mention mac. Windows is not more compatible. If you planned on distributing it, why would you use windows API to begin with?

Quote:
Because I restricted the console application to run only on a Windows Machine makes me retarded? Really?


Yes, because it was 2 lines which could have easily been avoided.

A perfect example of compatibility is a PS2 emulator.

There is a linux version, but you can't run gsdx plugins which are significantly better then ZEROgs.

Easily avoided or not, I have no intentions of releasing the code.
Back to top
View user's profile Send private message
Noz3001
I'm a spammer
Reputation: 26

Joined: 29 May 2006
Posts: 6220
Location: /dev/null

PostPosted: Tue Nov 02, 2010 9:46 pm    Post subject: Reply with quote

Chase Payne wrote:
SexualisedLanguage wrote:
Chase Payne wrote:
I Used to run C# bots in games that where 100% incompatible with macs, even with the .net emulation. So obviously, not all c# can be ran.


I didn't mention mac. Windows is not more compatible. If you planned on distributing it, why would you use windows API to begin with?

Quote:
Because I restricted the console application to run only on a Windows Machine makes me retarded? Really?


Yes, because it was 2 lines which could have easily been avoided.

A perfect example of compatibility is a PS2 emulator.

There is a linux version, but you can't run gsdx plugins which are significantly better then ZEROgs.

Easily avoided or not, I have no intentions of releasing the code.


I have no idea what you are talking about and neither do you. How is a PS2 emulator at all relevant?
Back to top
View user's profile Send private message MSN Messenger
Chase Payne
Grandmaster Cheater
Reputation: 1

Joined: 20 Mar 2008
Posts: 533

PostPosted: Tue Nov 02, 2010 9:51 pm    Post subject: Reply with quote

SexualisedLanguage wrote:
Chase Payne wrote:
SexualisedLanguage wrote:
Chase Payne wrote:
I Used to run C# bots in games that where 100% incompatible with macs, even with the .net emulation. So obviously, not all c# can be ran.


I didn't mention mac. Windows is not more compatible. If you planned on distributing it, why would you use windows API to begin with?

Quote:
Because I restricted the console application to run only on a Windows Machine makes me retarded? Really?


Yes, because it was 2 lines which could have easily been avoided.

A perfect example of compatibility is a PS2 emulator.

There is a linux version, but you can't run gsdx plugins which are significantly better then ZEROgs.

Easily avoided or not, I have no intentions of releasing the code.


I have no idea what you are talking about and neither do you. How is a PS2 emulator at all relevant?

In terms of gaming, which many people pay for upgrades for, running anything other then windows can harm your machine in many ways.

Many things that are coded, like emulators preform worse because of the compatibility issues with windows and linux, sure you can run a virtual machine but that kind of defeats the purpose.

Most of the issues involve direct X and Open Gl though, which open gl is worse than direct X.

Many programs I download are not even an option to download for another OS.
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Tue Nov 02, 2010 11:06 pm    Post subject: Reply with quote

Console apps are not meant to be "paused", they are meant to be ran from the console. If you need the application to stay open, create a Gui for the application then. For debugging purposes and self-creations that you have no intentions on releasing, pausing the console isn't a huge deal though.

I'd suggest not using system( .. ) at all either if you plan to pause the console, use something like:

Code:
std::cin.sync();
std::cin.ignore();


Or something similar. Again, it's not meant to be used for actual applications.


Quote:
Remove 2 lines of terrible code and it'll run on any platform with g++. This is just windows


Not every developer is a cross-platform developer, and not every person uses different operating systems. There is nothing wrong with developing for a single system type. And there is nothing "terrible" about the lines of code used just because it wont compile under another compiler.


Quote:
It's a shame most developers are this retarded. Also, C# can be compiled to run on Linux too.


Really don't see how he is "retarded" when he is developing specifically on Windows, stated he is only interested in working on Windows 7, and even stated he has no interest in releasing the code. It's a shame ego driven people like you exist.

Anyway the topic is solved so locking this.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   This topic is locked: you cannot edit posts or make replies.    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
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