|
there was a way to do it in vc 6...i forget how...
the trouble i am having is the debug works fine but the release crashes.
so i want to step into the release version....
it could be done in vc6...how to do it in vs2008?
thanks!
|
|
|
|
|
You can debug a release version but the code tends to have been moved around a bit by the compiler. Make sure you're building with debug information (right click on project->settings, C++->general, debug information format set to program database) and then copy the PDB file to the directory you're running your code from. If it doesn't remove the bug try disabling optimisation as well - it makes debugging easier.
Cheers,
Ash
|
|
|
|
|
thank you Ash!
I did what you said...
Make sure you're building with debug information (right click on project->settings, C++->general, debug information format set to program database)
then I set a breakpoint in the release version of the code (in the IDE) and ran it expecting it to stop at the breakpoint. But it did not and the breakpoint did not look colored anymore. It just ran on and crashed.
I would like the code to stop executing at the breakpoint so I can step in and proceed line by line.
thanks!
|
|
|
|
|
In addition, that Ash said, please check the following :
- C++\Optimization: NO
- Linker\GenerateDebugInformation: YES
They sought it with thimbles, they sought it with care;
They pursued it with forks and hope;
They threatened its life with a railway-share;
They charmed it with smiles and soap.
|
|
|
|
|
Eugen Podsypalnikov wrote: - C++\Optimization: NO
Generally, you go to the trouble of debugging a release version because the debug version is working and you want to see why optimizations are screwing up the release version. If you turn off optimizations, you have the debug version.
Once you agree to clans, tribes, governments...you've opted for socialism. The rest is just details.
|
|
|
|
|
Wow...
Thank you !
They sought it with thimbles, they sought it with care;
They pursued it with forks and hope;
They threatened its life with a railway-share;
They charmed it with smiles and soap.
|
|
|
|
|
Thank you!! Thank you!! Thank you!!!
I can step in now!
|
|
|
|
|
|
Very informative!
Reading them now.
Many thanks
|
|
|
|
|
you're welcome.
|
|
|
|
|
how can you modify modal dialog buttons to look like xp style in mfc?
is there a class in mfc that does that for you?
|
|
|
|
|
|
|
Hi!
I've declared a protected variable in a base class. I've assigned value and print the variable in a derived class. It prints correctly. I've printed the same variable inside another derived class. But it prints nothing. How to print the variable that is altered inside another derived class?
|
|
|
|
|
What do you mean by "it prints nothing"? Show some relevant code, don't forget the <pre> </pre> tags please.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
T.RATHA KRISHNAN wrote: I've printed the same variable inside another derived class. But it prints nothing.
?
this sample code
#include <iostream>
class A
{
protected:
int a;
public:
A(int a):a(a){}
void show(){ std::cout << "this is A, a=" << a << std::endl;}
};
class B: public A
{
public:
B(int b):A(b){}
void show(){ std::cout << "this is B, a=" << a << std::endl;}
};
class C: public B
{
public:
C(int c):B(c){}
void show(){ std::cout << "this is C, a=" << a << std::endl;}
};
int main()
{
A a(3);
B b(4);
C c(5);
a.show();
b.show();
c.show();
return 0;
}
produces:
this is A, a=3
this is B, a=4
this is C, a=5
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
T.RATHA KRISHNAN wrote: I've declared a protected variable in a base class. I've assigned value and print the variable in a derived class. It prints correctly. I've printed the same variable inside another derived class. But it prints nothing. How to print the variable that is altered inside another derived class?
Are you asking how to share a member variable of base class across different derived classes such that changing in one will reflect in the others?
...byte till it megahertz...
|
|
|
|
|
Yes. Exactly what I want.
|
|
|
|
|
i think friend functions can be used....
|
|
|
|
|
You want a class variable as opposed to an instance variable. A class variable in C++ is declared using the static keyword.
class A
{
protected:
static int my_class_variable;
};
This variable will be shared among all instances of class A and its derived classes.
|
|
|
|
|
Hi!
If I use static as you said, I got the following linker errors:
Error 80 error LNK2001: unresolved external symbol "protected: static int CGameState::musicVolume" (?musicVolume@CGameState@@1HA) D:\Goldminer\GameOptionsMenuState.obj
|
|
|
|
|
You have to later initialize it somewhere, for instance, like
int CGameState::musicVolume = 0;
...byte till it megahertz...
|
|
|
|
|
See what Niklas posted.
...byte till it megahertz...
|
|
|
|
|
Read bleedingfingers' answer.
|
|
|
|
|
hey hey hey don't Moak me I had asked the OP a question and before I could reply after my lunch, Niklas had answered it. I find not following up on a question with a reply to be rude and there was no point in re replying.
...byte till it megahertz...
|
|
|
|