dospy 51 Junior Poster in Training

i am sorry, this:

SecClass :: SecClass( MainClass nMainClass )

was meant to be this:

SecClass :: SecClass( MainClass *nMainClass )

i already have the assigment constructor, as for the copy constuctor, not(because i don't need it). in the SecClass constructor it was meant to pass the address of the MainClass, so the SecClass can access MainClass object and functions

and as for the crash, i am very sure that it crashes when the SecClass tryes to access on member of the MainClass after calling the MainClass destructor, i used breakpoints to test this...

Edit: the real code is a lot more complex, this was just an example witch i used to express my problem easy

dospy 51 Junior Poster in Training

i know you cannot understand anything from the title and i am sorry but i don't know how to say it because it's a little complicated, so i won't give details of my problem, i hope you can understand from the code

classB.h:

#ifndef CLASSB_H
#define CLASSB_H

class MainClass;      // so we can declare a pointer of class B

class SecClass
{
public:
MainClass *m_MainClass;

SecClass( );
~SecClass( );
};

classB.cpp

#include "classB.h"
#include "classA.h"

//
// A
//

SecClass :: SecClass( MainClass nMainClass )
{
    m_MainClass = nMainClass;
}

SecClass :: ~SecClass( )
{
    m_MainClass->someFunct( );
}

classA.h:

#ifndef CLASSA_H
#define CLASSA_H

class SecClass;      // so we can declare a pointer of class B

class MainClass
{
public:
SecClass *m_SecClass;
int m_ID;

MainClass( );
~MainClass( );
bool Update( );
void someFunct( ) { }
};

#endif

classA.cpp

#include <iostream>
#include "classA.h"
#include "classB.h"

//
// A
//

MainClass :: MainClass( )
{
    m_SecClass = new SecClass( this );
}

MainClass :: ~MainClass( )
{
    delete m_SecClass;
}

bool MainClass :: Update( )
{
    // do stuff...
    
    if( ... )
        return true;

    return false;
}

void main( )
{
    MainClass *gMainClass = new MainClass( );
    
    while( gMainClass->Update( ) )
    {
        // main program loop
    }

    delete gMainClass;    // this will crash
}

so, i'll explain
MainClass creates a new instance of a SecClass
The SecClass creates a pointer to the main class( to access some funct/values )
when the main class destructor …

dospy 51 Junior Poster in Training

hi, i am new to this forum so i made this post for presenting myself
oh, and for those who would say that i registered about 3 years ago, i must say that when i registere, i didn't intend to be active on forum, i registered only to put one question, witch is lame -_-( i hope you can forgive me ), now i am thinking to frequently visit this forum

so, i am 16 years old, i like programming( but i don't even think about learning other programming language than C++ :D ) and i am willful to learn as much as i can

i started programing by editting a source code downloaded from the inthernet because i wanted to know how exacty the program worked and to change commands name, making them shorter ( i know, i am lazy :D ) and i began to learn more and more by codding...

at last, i ended up learning online from some tutorials and a PDF document
now i have the basig knowladge of the most important aspects of c++, more specifically, object oriented programming.

in the near future i am willing to continue by learning how to develope a chat programm ( client/server ) through sockets.

thx for the patiance accorded and i am sorry for this long post

dospy 51 Junior Poster in Training

man sry for disturbing...i have fount a readme file in the directory where is my program instaled that tells you how to compile it...
thx for all

dospy 51 Junior Poster in Training

dont rlly know...told ya i am noob in this thing

dospy 51 Junior Poster in Training

well this is the entire project:...

and thx again for your help :)

dospy 51 Junior Poster in Training

he told me to post the whole program so he can try to compile it...welll the whole programe has 18MB

dospy 51 Junior Poster in Training

i have only edited the game.cpp(GhostOne/ghost/game.cpp) file and the game_base.cpp(GhostOne/ghost/game_base.cpp)

also this program its not made by me...i have only downloaded and tried to edit it

and thx for help by the way

i cannot post the file....
Invalid Post specified. If you followed a valid link, please notify the administrator
this is what tells me after i attach file ...i think thi file size its too big (18MB)

dospy 51 Junior Poster in Training

i found out how to compile in microsoft visual c++ expres edition but now i have another problem....i cannot compile/build any file becose gives me this error :


1>------ Build started: Project: ghost, Configuration: Debug Win32 ------
1>Embedding manifest...
1>mt.exe : general error c10100b1: Failed to load file "..\Debug\ghost.exe". The system cannot find the path specified.
1>Build log was saved at "file://c:\Dragos\Project\ghost\ghost\Debug\BuildLog.htm"
1>ghost - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
anyway....if i tri to compile the original game.cpp file gives me the same error...so i think my visual c++ misses 1 file
if that isnt the problem tell me what is and how to resolve it pls

dospy 51 Junior Poster in Training

yea i know in microsoft visual studio c++ expres eddition i may resolve my problems but i don't know how to compile in that program:D...please tell me how

dospy 51 Junior Poster in Training

i have GHostOne advanced remote host bot last version but i have some problems edditting it.
when i try to compile game.cpp (edited by me) gives me a lot of errors that i cannot solv (compile.txt file)
anyway...i cannot even compile the originat cpp file cuz he gives me a lot of errors too....so i think its my C++ compiler problems
i use Dev C++ compiler
what should i do?


PS: someone told me that i shall tri to compile again after i updat my libraries...is he right?