Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. vtable pointer initialize failed! [modified]

vtable pointer initialize failed! [modified]

Scheduled Pinned Locked Moved C / C++ / MFC
debuggingtutorialhelpannouncementlearning
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    white jungle
    wrote on last edited by
    #1

    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!

    S 1 Reply Last reply
    0
    • W white jungle

      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!

      S Offline
      S Offline
      Stephen Hewitt
      wrote on last edited by
      #2

      Can you show this "A"?

      Steve

      W 1 Reply Last reply
      0
      • S Stephen Hewitt

        Can you show this "A"?

        Steve

        W Offline
        W Offline
        white jungle
        wrote on last edited by
        #3

        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!

        S 1 Reply Last reply
        0
        • W white jungle

          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!

          S Offline
          S Offline
          Stephen Hewitt
          wrote on last edited by
          #4

          Can you show we where the crash occurs? I suspect you are relying on the order of static initialisation.

          Steve

          W 1 Reply Last reply
          0
          • S Stephen Hewitt

            Can you show we where the crash occurs? I suspect you are relying on the order of static initialisation.

            Steve

            W Offline
            W Offline
            white jungle
            wrote on last edited by
            #5

            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!

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups