vtable pointer initialize failed! [modified]
-
I dont' know how to named the title! My program is compiled by vc6+sp6+SDK2003 with release mode but have debug information in it And there is a static member called A(faked name). And is a instance of class CSite.CSite is inherited from a abstract class. example: class Base { void virtual int add(int a,int b)=0; }; class CSite:public Base { //blablabla... }; When debug the program and set a breakpoint at the construtor of the member A. I found that the vtable pointer was initlialized to NULL. And of course the program crashed! I have no idea with this issue! Can any one who please give me a handle on this! BTW:there is not anything wrong if I debug the program in debug mode! Thank you very much! I must appologise for my poor english,hope you can understand what I said! -- modified at 23:47 Wednesday 31st January, 2007
Don't look at me in that way!
-
I dont' know how to named the title! My program is compiled by vc6+sp6+SDK2003 with release mode but have debug information in it And there is a static member called A(faked name). And is a instance of class CSite.CSite is inherited from a abstract class. example: class Base { void virtual int add(int a,int b)=0; }; class CSite:public Base { //blablabla... }; When debug the program and set a breakpoint at the construtor of the member A. I found that the vtable pointer was initlialized to NULL. And of course the program crashed! I have no idea with this issue! Can any one who please give me a handle on this! BTW:there is not anything wrong if I debug the program in debug mode! Thank you very much! I must appologise for my poor english,hope you can understand what I said! -- modified at 23:47 Wednesday 31st January, 2007
Don't look at me in that way!
Can you show this "A"?
Steve
-
Can you show this "A"?
Steve
A is a static instance of class CSite
class ISite { public: virtual const char* getSiteName() =0; virtual bool postRequest() =0; .....//there is a lot of method in this class! }; class CSite:public ISite { public : //implement of virtual method of baseclass ...... }
in some other cpp file,I make a static member like this:static CSite defaultSite;
Now I set Optimizations to normal in project setting!But the problem is still there!Don't look at me in that way!
-
A is a static instance of class CSite
class ISite { public: virtual const char* getSiteName() =0; virtual bool postRequest() =0; .....//there is a lot of method in this class! }; class CSite:public ISite { public : //implement of virtual method of baseclass ...... }
in some other cpp file,I make a static member like this:static CSite defaultSite;
Now I set Optimizations to normal in project setting!But the problem is still there!Don't look at me in that way!
Can you show we where the crash occurs? I suspect you are relying on the order of static initialisation.
Steve
-
Can you show we where the crash occurs? I suspect you are relying on the order of static initialisation.
Steve
Thank you very much Hewitt! I think I solved the problem follow your reminder. now everything is seemed OK! the class CSite has also some static member,and these member is defined at the 'site.cpp' ,but I define the defaultSite instance at the other cpp file (services.cpp)before!I think this is why I get a error! Now I move the definition of defaultSite into the 'site.cpp'. Thank you again for your help! ^_^
Don't look at me in that way!