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. Inheritance problem

Inheritance problem

Scheduled Pinned Locked Moved C / C++ / MFC
helphtmlcomoopquestion
12 Posts 3 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.
  • Z Zac Howland

    khb wrote:

    error C2512: 'basic_istream >' : no appropriate default constructor available

    std::istream is a typedef for basic_istream<char, char_traits<char> >. basic_istream has the following constructor: explicit basic_istream(basic_streambuf *_Strbuf, bool _Isstd = false); Do you really want your streambuf to be null? If so, try casting 0 as follows: std::istream((std::streambuf*)0); If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week Zac

    K Offline
    K Offline
    khb
    wrote on last edited by
    #3

    Yeah, the streambuf should to be null, as in the original implementation it is replaced by an instance of the inherited streambuffer class using rdbuf(). However, casting 0 to std::streambuf* results in the same errors. If you have another idea on how I get the istream constructor called correctly, I would be really happy. Thank you very much for your help, Marcus.

    Z 1 Reply Last reply
    0
    • K khb

      Yeah, the streambuf should to be null, as in the original implementation it is replaced by an instance of the inherited streambuffer class using rdbuf(). However, casting 0 to std::streambuf* results in the same errors. If you have another idea on how I get the istream constructor called correctly, I would be really happy. Thank you very much for your help, Marcus.

      Z Offline
      Z Offline
      Zac Howland
      wrote on last edited by
      #4

      Strange. Not sure why that would be a problem ... I was able to compile your code using g++ with no problems. If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week Zac

      E 1 Reply Last reply
      0
      • Z Zac Howland

        Strange. Not sure why that would be a problem ... I was able to compile your code using g++ with no problems. If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week Zac

        E Offline
        E Offline
        earl
        wrote on last edited by
        #5

        The original author is using VC6. For the love of god, VS2005 Express is free. Get it. earl

        Z 1 Reply Last reply
        0
        • E earl

          The original author is using VC6. For the love of god, VS2005 Express is free. Get it. earl

          Z Offline
          Z Offline
          Zac Howland
          wrote on last edited by
          #6

          I realize that. Generally, GNU is more strick about things like this that Microsoft's compiler. I have VS2005 Pro ... but it doesn't run on Linux, which is what I have to use at work. If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week Zac

          E 1 Reply Last reply
          0
          • Z Zac Howland

            I realize that. Generally, GNU is more strick about things like this that Microsoft's compiler. I have VS2005 Pro ... but it doesn't run on Linux, which is what I have to use at work. If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week Zac

            E Offline
            E Offline
            earl
            wrote on last edited by
            #7

            Sorry Zac, I meant to reply to the original author. VS6 is broken in some ways; I just think that trying to make things work on it is kind of silly when you have a far superior alternative available for free. And the gnu compiler chain is quite nice, but the 3.x series is far superior to VS6 in terms of the probabilty of standard-conforming code compiling and working. earl

            Z 1 Reply Last reply
            0
            • E earl

              Sorry Zac, I meant to reply to the original author. VS6 is broken in some ways; I just think that trying to make things work on it is kind of silly when you have a far superior alternative available for free. And the gnu compiler chain is quite nice, but the 3.x series is far superior to VS6 in terms of the probabilty of standard-conforming code compiling and working. earl

              Z Offline
              Z Offline
              Zac Howland
              wrote on last edited by
              #8

              earl wrote:

              And the gnu compiler chain is quite nice, but the 3.x series is far superior to VS6 in terms of the probabilty of standard-conforming code compiling and working.

              Agreed. But sadly, there are many companies that still do all their development in VS6. If the OP hasn't already done so, he might want to download the fixed STL from Dinkumware's site (they are the ones that wrote the version that ships with VS). There were several bugs that were fixed, not sure if this might be one of them. If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week Zac

              K 1 Reply Last reply
              0
              • Z Zac Howland

                earl wrote:

                And the gnu compiler chain is quite nice, but the 3.x series is far superior to VS6 in terms of the probabilty of standard-conforming code compiling and working.

                Agreed. But sadly, there are many companies that still do all their development in VS6. If the OP hasn't already done so, he might want to download the fixed STL from Dinkumware's site (they are the ones that wrote the version that ships with VS). There were several bugs that were fixed, not sure if this might be one of them. If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week Zac

                K Offline
                K Offline
                khb
                wrote on last edited by
                #9

                Unfortunately, I have to stick to VS6. It's really bad that the behavior might come from bugs in the STL :( Can I simply replace the problematic STL classes? If so, can you provide the Link to the Dinkumware's site? Thank you for you discussion. That brought some light into the dark. I already started thinking that I'm getting to old for understanding C++ ;) Therefore I like your slogan, Zac! Regards, Marcus.

                Z E 2 Replies Last reply
                0
                • K khb

                  Unfortunately, I have to stick to VS6. It's really bad that the behavior might come from bugs in the STL :( Can I simply replace the problematic STL classes? If so, can you provide the Link to the Dinkumware's site? Thank you for you discussion. That brought some light into the dark. I already started thinking that I'm getting to old for understanding C++ ;) Therefore I like your slogan, Zac! Regards, Marcus.

                  Z Offline
                  Z Offline
                  Zac Howland
                  wrote on last edited by
                  #10

                  I think Microsoft has a link in MSDN for a service pack download that does it. But here is Dinkumware's site: http://www.dinkumware.com/. If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week Zac

                  K 1 Reply Last reply
                  0
                  • Z Zac Howland

                    I think Microsoft has a link in MSDN for a service pack download that does it. But here is Dinkumware's site: http://www.dinkumware.com/. If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week Zac

                    K Offline
                    K Offline
                    khb
                    wrote on last edited by
                    #11

                    Thanks a million! Regards, Marcus.

                    1 Reply Last reply
                    0
                    • K khb

                      Unfortunately, I have to stick to VS6. It's really bad that the behavior might come from bugs in the STL :( Can I simply replace the problematic STL classes? If so, can you provide the Link to the Dinkumware's site? Thank you for you discussion. That brought some light into the dark. I already started thinking that I'm getting to old for understanding C++ ;) Therefore I like your slogan, Zac! Regards, Marcus.

                      E Offline
                      E Offline
                      earl
                      wrote on last edited by
                      #12

                      Marcus, There is simply quite a bit of valid code that the VS6 compiler is unable to compile. This in turn limits the quality of the STL that can be provided for it. At the end of the day, it's an 8 year old compiler that was written before the C++ standard was finalized IIRC. earl

                      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