hi
I have created an application and apparently in debug is fully functional but when compile as a release and then run it it doesn't work.
anyone knows why?
thanks
Printable View
hi
I have created an application and apparently in debug is fully functional but when compile as a release and then run it it doesn't work.
anyone knows why?
thanks
What is the error u got?Quote:
Originally posted by andreshs1
hi
I have created an application and apparently in debug is fully functional but when compile as a release and then run it it doesn't work.
thanks
There could be several reasons why your application works only in debug mode. Here are some things to check:
1) Statements that need to be executed are not in assert statements.
2) Enough memory is allocated for your variables.
It's hard to know what's going on without an error description.
Take a look at this thread http://www.codeguru.com/forum/showth...hreadid=269905
I think it will solve ur problem
also take a look at following query from another user.
http://www.codeguru.com/forum/showth...ug+and+release:wave:
Well, besides that based on your description, one could only take wild guesses...take a look at the following FAQ...Quote:
Originally posted by andreshs1
I have created an application and apparently in debug is fully functional but when compile as a release and then run it it doesn't work.
Thank you guys for the replys
the problem I have is that when I launch the application created in release mode, when I tried to connect the client to the server, the server uses 98% of the CPU.
the Server uses two thread, do you think that could be the reason, as a matter of fact I didn't set priority to any of the threads since I thought that it would be normal by default.
so, how can I find out where the problem is?
Have you read the FAQ Andreas pointed you to? (doesn't seem so, or you wouldn't use the term "release mode" any more;)) That FAQ explains how you can debug your release build. Now multithreaded applications are not easy to debug, but it's possible. It's very likely that you will be able to find out what's wrong with your release build by running it in the debugger.Quote:
Originally posted by andreshs1
so, how can I find out where the problem is?
Hi, I am reading it right now.
I am also initialising all the variables on the constructors.
Do I also have to initialise the arrays? or the arrays when created are assigned memory automatically?
That is a great faq!! congratulations!
Thanks
Not sure what you mean here... Yes, when an array is created (in either way), memory is assigned to it, of course. However, that memory is uninitialized, so you'll have to initialize the elements to meaningful values before using them.Quote:
Originally posted by andreshs1
Do I also have to initialise the arrays? or the arrays when created are assigned memory automatically?
Well...that's kind of taste, nevertheless, I usually initialize everything...pointers, variables, arrays etc. :cool:Quote:
Originally posted by andreshs1
I am also initialising all the variables on the constructors.
Do I also have to initialise the arrays? or the arrays when created are assigned memory automatically?
hello there
I have been checking what was wrong and ufffffff lots of things just doesn't work
lets start
I have a dialog class that I call at some point
this class has a constructor asCode:CUserDlg userDlg = new CUserDlg();
INT_PTR rtnDlg = 0;
int rtn = 0;
rtnDlg = userDlg.DoModal();
and on the OnInitDialog I try to initialise all the variablesCode:CUserDlg::CUserDlg(CWnd* pParent /*=NULL*/)
: CDialog(CUserDlg::IDD, pParent)
, m_pClientDlg(NULL)
, m_existingUser(0)
, test(_T(""))
, m_userName(_T(""))
, m_passWord(_T(""))
{
}
but when I try to access them from any of the methods of the class it says that the pointers are not right
and it doesnt workCode:m_existingUser = 0;
test = _T("");
m_userName =_T("");
m_passWord="a";
how do I initialise the variables for the previous example?????
and how would you initialise an array of char such as
char myarray[25];
Thanks
Well...without showing what types these variables are...there is basically no way to answer that question. Post your class declaration.
sorry
USERDET is a structureCode:public:
CEdit* m_uNameEdt;
CEdit* m_pWordEdt;
CTCPChatClientDlg* m_pClientDlg;
BOOL m_newUser;
CString m_userName;
CString m_passWord;
int m_existingUser;
USERDET userDet;
then I also want to copy the value from m_userName into userDet.userName and I useCode:typedef struct USERDET{
BOOL newUser;
char userName[25];
char passWord[25];
}USERDET;
but the value stored in the variable is not copied properly instead I get ascii charactersCode:strcpy(userDet.userName,m_userName);
Thanks a lot for your help
Well...first of all there is no need to do the 'typedef' thing with structures in C++ since the 'struct' keyword already defines a new datatype...thusQuote:
Originally posted by andreshs1
Code:typedef struct USERDET{
BOOL newUser;
char userName[25];
char passWord[25];
}USERDET;
is enough...Code:struct USERDET
{
BOOL newUser;
char userName[25];
char passWord[25];
};
To initialize the structure properly add a constructor...
Besides that, your code looks okay...where do you use the 'strcpy()' command?Code:struct USERDET
{
BOOL newUser;
char userName[25];
char passWord[25];
USERDET()
{
newUser = FALSE;
memset(userName, 0, sizeof(userName));
memset(passWord, 0, sizeof(passWord));
}
};
When the dialog doModal return I copy the values that it got from the CEdit boxes
the userDlg.m_userName contains the correct value but when it is copied to the m_userDet.userName there are only ascii characters copies.Code:rtnDlg = userDlg.DoModal();
if (rtnDlg == IDOK)
{
strcpy(m_userDet.userName,userDlg.m_userName);
strcpy(m_userDet.passWord,userDlg.m_passWord);
//stablish connection to server
if (!cConnect->GetConnected(m_userDet))
{
I thought that it could be b'cos I needed to initialised in the constructor of the class, or maybe that the array of char is not initialised properly.
Thanks