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. Migration from VC2006 to 2008

Migration from VC2006 to 2008

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestionannouncement
9 Posts 5 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.
  • S Offline
    S Offline
    Stan the man
    wrote on last edited by
    #1

    HI. I have been using 2006 and have not upgraded through the years. All works. Now, I installed VC2008 and find that the old code has many compiler errors. I am not sure where these come from. One is ex: for (int x = 0; x< 100;x++) .... for (x = 0; x<5;x++).... THis will nor work anymore... It seems I need to declare the X outside the for loop. The other is : Error 2440: 'static cast' cannot convert from 'void (thiscall CMyView::*)(WPARAM, LPARAM)' to '(LRESULT (thiscall CWnd::*)(WPARAM, LPARAM)' Not sure what this one is. Never had any of these problems before. Also, just curious if maybe I should just go to 2011 version versus 2008? Any comments? Appreciate any help or advise. Thanks. Stan the man

    L C J 3 Replies Last reply
    0
    • S Stan the man

      HI. I have been using 2006 and have not upgraded through the years. All works. Now, I installed VC2008 and find that the old code has many compiler errors. I am not sure where these come from. One is ex: for (int x = 0; x< 100;x++) .... for (x = 0; x<5;x++).... THis will nor work anymore... It seems I need to declare the X outside the for loop. The other is : Error 2440: 'static cast' cannot convert from 'void (thiscall CMyView::*)(WPARAM, LPARAM)' to '(LRESULT (thiscall CWnd::*)(WPARAM, LPARAM)' Not sure what this one is. Never had any of these problems before. Also, just curious if maybe I should just go to 2011 version versus 2008? Any comments? Appreciate any help or advise. Thanks. Stan the man

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      In your first statement above you declare x to be an integer, however it only exists within the for block, so (I assume, since you did not show all your code) when you get to the second statement, x is unknown. The C2440 message is described here[^].

      One of these days I'm going to think of a really clever signature.

      S 1 Reply Last reply
      0
      • L Lost User

        In your first statement above you declare x to be an integer, however it only exists within the for block, so (I assume, since you did not show all your code) when you get to the second statement, x is unknown. The C2440 message is described here[^].

        One of these days I'm going to think of a really clever signature.

        S Offline
        S Offline
        Stan the man
        wrote on last edited by
        #3

        The problem is that it works in the old code. The declaration for x is valid through the function that the second for is in. So it never was a problem before.

        L M 2 Replies Last reply
        0
        • S Stan the man

          The problem is that it works in the old code. The declaration for x is valid through the function that the second for is in. So it never was a problem before.

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Things change, and compilers enforce standards more rigidly.

          One of these days I'm going to think of a really clever signature.

          1 Reply Last reply
          0
          • S Stan the man

            HI. I have been using 2006 and have not upgraded through the years. All works. Now, I installed VC2008 and find that the old code has many compiler errors. I am not sure where these come from. One is ex: for (int x = 0; x< 100;x++) .... for (x = 0; x<5;x++).... THis will nor work anymore... It seems I need to declare the X outside the for loop. The other is : Error 2440: 'static cast' cannot convert from 'void (thiscall CMyView::*)(WPARAM, LPARAM)' to '(LRESULT (thiscall CWnd::*)(WPARAM, LPARAM)' Not sure what this one is. Never had any of these problems before. Also, just curious if maybe I should just go to 2011 version versus 2008? Any comments? Appreciate any help or advise. Thanks. Stan the man

            C Offline
            C Offline
            CPallini
            wrote on last edited by
            #5

            Stan the man wrote:

            for (int x = 0; x< 100;x++)
            ....
             
            for (x = 0; x<5;x++)....

            THis will nor work anymore... It seems I need to declare the X outside the for loop.

            This because the VC compiler was not compliant with the C++ standard. See this page[^] for a reason why. That eventually changed and VC is now compliant.

            Stan the man wrote:

            Error 2440: 'static cast' cannot convert from 'void (thiscall CMyView::*)(WPARAM, LPARAM)' to '(LRESULT (thiscall CWnd::*)(WPARAM, LPARAM)'
             
            Not sure what this one is. Never had any of these problems before.

            This is a change in the Microsoft's MFC library (see for instance here[^]).

            Veni, vidi, vici.

            S 1 Reply Last reply
            0
            • C CPallini

              Stan the man wrote:

              for (int x = 0; x< 100;x++)
              ....
               
              for (x = 0; x<5;x++)....

              THis will nor work anymore... It seems I need to declare the X outside the for loop.

              This because the VC compiler was not compliant with the C++ standard. See this page[^] for a reason why. That eventually changed and VC is now compliant.

              Stan the man wrote:

              Error 2440: 'static cast' cannot convert from 'void (thiscall CMyView::*)(WPARAM, LPARAM)' to '(LRESULT (thiscall CWnd::*)(WPARAM, LPARAM)'
               
              Not sure what this one is. Never had any of these problems before.

              This is a change in the Microsoft's MFC library (see for instance here[^]).

              Veni, vidi, vici.

              S Offline
              S Offline
              Stan the man
              wrote on last edited by
              #6

              Thank everyone for their input. Will go through and properly get everything done. Appreciate the help.

              C 1 Reply Last reply
              0
              • S Stan the man

                Thank everyone for their input. Will go through and properly get everything done. Appreciate the help.

                C Offline
                C Offline
                CPallini
                wrote on last edited by
                #7

                You are welcome.

                Veni, vidi, vici.

                1 Reply Last reply
                0
                • S Stan the man

                  HI. I have been using 2006 and have not upgraded through the years. All works. Now, I installed VC2008 and find that the old code has many compiler errors. I am not sure where these come from. One is ex: for (int x = 0; x< 100;x++) .... for (x = 0; x<5;x++).... THis will nor work anymore... It seems I need to declare the X outside the for loop. The other is : Error 2440: 'static cast' cannot convert from 'void (thiscall CMyView::*)(WPARAM, LPARAM)' to '(LRESULT (thiscall CWnd::*)(WPARAM, LPARAM)' Not sure what this one is. Never had any of these problems before. Also, just curious if maybe I should just go to 2011 version versus 2008? Any comments? Appreciate any help or advise. Thanks. Stan the man

                  J Offline
                  J Offline
                  jschell
                  wrote on last edited by
                  #8

                  Stan the man wrote:

                  I have been using 2006

                  Just for my own sanity you are actually referring to VC6 right? There is no such thing as "VC2006" and the compilers around 2006 such as Visual Studio 2005 were compliant. But Visual Studio C++ 6, known as VC6, was released in 1998 and was not compliant.

                  1 Reply Last reply
                  0
                  • S Stan the man

                    The problem is that it works in the old code. The declaration for x is valid through the function that the second for is in. So it never was a problem before.

                    M Offline
                    M Offline
                    Marius Bancila
                    wrote on last edited by
                    #9

                    It was not a problem before, because the compiler did things that were not standard. But starting with Visual Studio 2005, the scope of the variables does not exceed the block they are defined in. And that applies to for loops too. So you either declare the index variable before the first for loop, or re-declare it in each for statement. As for the other problem, it's also an error with the old compiler. Your actual handler should return LRESULT, not void. So change the function to the requested signature (take a WPARAM and LPARAM and return LRESULT) and everything will be OK. BTW, there is no such thing as VS2006. There is VS2002, VS2003, VS2005 and VS2008.

                    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