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. VS 2008, error C4430

VS 2008, error C4430

Scheduled Pinned Locked Moved C / C++ / MFC
c++visual-studiohelp
10 Posts 4 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.
  • N Offline
    N Offline
    Nandu_77b
    wrote on last edited by
    #1

    class base { protected: base(const&base) {} }; When the above code is compiled with VS 6.0 compiles without any error, but if the same is compiled in VS 2008 following is the error “error C4430: missing type specifier - int assumed. Note: C++ does not support default-int” Can you please let me know what causes this error.

    R S S 3 Replies Last reply
    0
    • N Nandu_77b

      class base { protected: base(const&base) {} }; When the above code is compiled with VS 6.0 compiles without any error, but if the same is compiled in VS 2008 following is the error “error C4430: missing type specifier - int assumed. Note: C++ does not support default-int” Can you please let me know what causes this error.

      R Offline
      R Offline
      Rajesh R Subramanian
      wrote on last edited by
      #2

      Are you instantiating the class? If yes, how are you instantiating the class? Where is the default constructor?

      It is a crappy thing, but it's life -^ Carlo Pallini

      modified on Friday, July 17, 2009 6:05 AM

      N 1 Reply Last reply
      0
      • R Rajesh R Subramanian

        Are you instantiating the class? If yes, how are you instantiating the class? Where is the default constructor?

        It is a crappy thing, but it's life -^ Carlo Pallini

        modified on Friday, July 17, 2009 6:05 AM

        N Offline
        N Offline
        Nandu_77b
        wrote on last edited by
        #3

        Constructor can have return type?

        R 1 Reply Last reply
        0
        • N Nandu_77b

          Constructor can have return type?

          R Offline
          R Offline
          Rajesh R Subramanian
          wrote on last edited by
          #4

          Sorry, I overlooked your query. The post is modified. Coffee needed. :-O

          It is a crappy thing, but it's life -^ Carlo Pallini

          N 1 Reply Last reply
          0
          • R Rajesh R Subramanian

            Sorry, I overlooked your query. The post is modified. Coffee needed. :-O

            It is a crappy thing, but it's life -^ Carlo Pallini

            N Offline
            N Offline
            Nandu_77b
            wrote on last edited by
            #5

            class base { protected: base(){} base(const&base) {} }; int _tmain(int argc, _TCHAR* argv[]) { base obj; return 0; } Even if the above case same error.

            R 1 Reply Last reply
            0
            • N Nandu_77b

              class base { protected: base(){} base(const&base) {} }; int _tmain(int argc, _TCHAR* argv[]) { base obj; return 0; } Even if the above case same error.

              R Offline
              R Offline
              Rajesh R Subramanian
              wrote on last edited by
              #6

              Nandu_77b wrote:

              class base { protected: base(){} base(const&base) {} }; int _tmain(int argc, _TCHAR* argv[]) { base obj; return 0; }

              The constructor is not public, so how can you create an object like that? Also, I don't see why would you receive a C4430 for this. I thought it must complain about not being able to access a protected function. (C2448 or whatever, I ain't sure - don't have a compiler here Searched for it, found it - C2248[^]).

              It is a crappy thing, but it's life -^ Carlo Pallini

              1 Reply Last reply
              0
              • N Nandu_77b

                class base { protected: base(const&base) {} }; When the above code is compiled with VS 6.0 compiles without any error, but if the same is compiled in VS 2008 following is the error “error C4430: missing type specifier - int assumed. Note: C++ does not support default-int” Can you please let me know what causes this error.

                S Offline
                S Offline
                Stuart Dootson
                wrote on last edited by
                #7

                Look at the placement of the reference specifier (the &). It' meant to come after the type you want to reference. So, the compiler is seeing const&base as (const&)==type and (base)==parameter name. Solution - use const base&.

                Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

                R 1 Reply Last reply
                0
                • S Stuart Dootson

                  Look at the placement of the reference specifier (the &). It' meant to come after the type you want to reference. So, the compiler is seeing const&base as (const&)==type and (base)==parameter name. Solution - use const base&.

                  Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

                  R Offline
                  R Offline
                  Rajesh R Subramanian
                  wrote on last edited by
                  #8

                  Mr. Eagle Eye prevails again. I hadn't noticed such a minute thing. Have a 5. :)

                  It is a crappy thing, but it's life -^ Carlo Pallini

                  S 1 Reply Last reply
                  0
                  • N Nandu_77b

                    class base { protected: base(const&base) {} }; When the above code is compiled with VS 6.0 compiles without any error, but if the same is compiled in VS 2008 following is the error “error C4430: missing type specifier - int assumed. Note: C++ does not support default-int” Can you please let me know what causes this error.

                    S Offline
                    S Offline
                    S p k 521
                    wrote on last edited by
                    #9

                    Use like constructor like this base(const base&) { }

                    1 Reply Last reply
                    0
                    • R Rajesh R Subramanian

                      Mr. Eagle Eye prevails again. I hadn't noticed such a minute thing. Have a 5. :)

                      It is a crappy thing, but it's life -^ Carlo Pallini

                      S Offline
                      S Offline
                      Stuart Dootson
                      wrote on last edited by
                      #10

                      Rajesh R Subramanian wrote:

                      Eagle Eye

                      That's what comes of too many years in safety-critical projects - stringent code reviews are an integral part of the process, so you develop an instinct for those small errors - you get :suss: of anything...

                      Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

                      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