I have a problem, my program compiles and runs fine from inside Dev C++ (py pressing F9 or Ctrl+F9,Ctrl+F10). But then I double click the exe file in explorer it chrashes imidiently. appears to have something to with a linked file. I have 2 cpp files and one h file. Using Dev-C++ 4.9.8.0
Any help?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The error only occurs if this line is in main.cpp: Highscore theTopScores = Highscore();
If I press Ctrl+F10 in Dev-C++ I can play the game and it works fine, but then I dubble click the exe file I get: "block_attack.exe - Application Error
The instruction at "0x00400947f" referenced memory at "0x192750c4". The memory could not be "read".
Click on OK to terminate the program
Click on CANCEL to debug the program"
clicking OK closes the program
CANCEL start VS.net2003
I havn't really made multifile program before, but I don't understand why it only runs from Dev-C++ ...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have a problem, my program compiles and runs fine from inside Dev C++ (py pressing F9 or Ctrl+F9,Ctrl+F10). But then I double click the exe file in explorer it chrashes imidiently. appears to have something to with a linked file. I have 2 cpp files and one h file. Using Dev-C++ 4.9.8.0
Any help?
what kind of programs are they?
console programs, or the somewhat dos like programs, will go away fast if the have no input needed.
otherwise i would suggest you post the offending source. we can not know what will make it crash without knowing what you have written.
obag
It's a clone of "Tetris Attack" using SDL and contains a game loop. The files are main.cpp , highscore.h and highscore.cpp
highscore.h is included in all cpp files ( #include "highscore.h" )
source for highscore:
//highscore.h
include <iostream>
include <fstream>
include <cstring>
include <stdlib.h>
using namespace std;
const int top = 10;
struct record
{
char name[30];
int score;
};
class Highscore
{
private:
record tabel[top];
void writeFile();
public:
Highscore()
{
ifstream scorefile("highscore.dat", ios::binary);
if(scorefile)
{
for(int i = 0; i<top; i++)
{
scorefile.read(tabel[i].name, sizeof(char[30]));
scorefile.read(reinterpret_cast<char>(&tabel[i].score), sizeof(int));
}
}
else
{
for(int i = 0; i<top; i++)
{
strcpy(tabel[i].name,"Poul Sander");
tabel[i].score = 2000 - i100;
}
}
scorefile.close();
writeFile();
}
bool isHighScore(int);
void addScore(char[],int);
int getScoreNumber(int);
//char* getScoreName(int);
};
The error only occurs if this line is in main.cpp: Highscore theTopScores = Highscore();
If I press Ctrl+F10 in Dev-C++ I can play the game and it works fine, but then I dubble click the exe file I get: "block_attack.exe - Application Error
The instruction at "0x00400947f" referenced memory at "0x192750c4". The memory could not be "read".
Click on OK to terminate the program
Click on CANCEL to debug the program"
clicking OK closes the program
CANCEL start VS.net2003
I havn't really made multifile program before, but I don't understand why it only runs from Dev-C++ ...
I discovered that if I ran it in combitability mode for windows 95 it ran fine...
"...appears to have something to with a linked file."
Do you get an error message from Windows? What (exactly) does it say? (Is there a DLL involved?)
-- Jim.