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 Visual studio 6

migration from Visual studio 6

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++csharpvisual-studiocom
35 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.
  • S Swap9

    Jochen, If you have a moment can you please have a look at this thread at msdn : http://social.msdn.microsoft.com/Forums/en-US/e68b0af5-ed25-4953-80e7-e88463149b77/fatal-error-1017-invalid-integer-constant-expression-in-ctypeh-during-migration-from-vs6-to-vs5?forum=vcgeneral[^] I tried that.Error from .cpp files are in thousands...they are of type : error C2065: ‘xyz’: undeclared identifier : error C2182: ‘pqr’ : illegal use of type 'void' : error C2065: ‘some variable’ : undeclared identifier : error C2146: syntax error : missing ';' before identifier ‘classname’ : error C2143: syntax error : missing ';' before '*' : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int : error C2040: ‘variable2’ : 'int *' differs in levels of indirection from ''unknown-type'' Removing them is manually one by one is the only way ? I am jsut trying to compile the code from visual studio 6 to visual studio 2006.

    J Offline
    J Offline
    Jochen Arndt
    wrote on last edited by
    #9

    Don't panic. Most of the errors are sourced by previous ones. If you resolve one many other will vanish. So start always with the very first error for a source file and try to locate the reason. After fixing some errors you may discover that other errors are similar to the already fixed ones. So the work is not as much as expected at first glance. If you don't get an error fixed post the relevant information here as said above.

    S 1 Reply Last reply
    0
    • J Jochen Arndt

      Don't panic. Most of the errors are sourced by previous ones. If you resolve one many other will vanish. So start always with the very first error for a source file and try to locate the reason. After fixing some errors you may discover that other errors are similar to the already fixed ones. So the work is not as much as expected at first glance. If you don't get an error fixed post the relevant information here as said above.

      S Offline
      S Offline
      Swap9
      wrote on last edited by
      #10

      Jochen - to start with small fix at a time i took one .cpp file which has few errors. I removed __STDC__ as you said it should never be used with .CPP file. Without __STDC__ I got this error : cpp(53) : error C3646: 'DWORD' : unknown override specifier xyz.cpp(53) : error C2143: syntax error : missing ';' before '__stdcall' xyzcpp(53) : error C2065: 'somevariable' : undeclared identifier xyz.cpp(54) : warning C4229: anachronism used : modifiers on data are ignored xyz.cpp(54) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int xyz.cpp(54) : error C2365: 'abc_process' : redefinition; previous definition was 'function' xyz.cpp(54) : error C2146: syntax error : missing ';' before identifier 'LPVOID' . . These errors i tried to remove by adding relevant header files : #include ,#include ,#include None of them seems to have any effect on the Output , also tried to refer to these header files with the help of setting the path variable. will you please suggest if it needs any other settings or any other work around.

      J 1 Reply Last reply
      0
      • S Swap9

        Jochen - to start with small fix at a time i took one .cpp file which has few errors. I removed __STDC__ as you said it should never be used with .CPP file. Without __STDC__ I got this error : cpp(53) : error C3646: 'DWORD' : unknown override specifier xyz.cpp(53) : error C2143: syntax error : missing ';' before '__stdcall' xyzcpp(53) : error C2065: 'somevariable' : undeclared identifier xyz.cpp(54) : warning C4229: anachronism used : modifiers on data are ignored xyz.cpp(54) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int xyz.cpp(54) : error C2365: 'abc_process' : redefinition; previous definition was 'function' xyz.cpp(54) : error C2146: syntax error : missing ';' before identifier 'LPVOID' . . These errors i tried to remove by adding relevant header files : #include ,#include ,#include None of them seems to have any effect on the Output , also tried to refer to these header files with the help of setting the path variable. will you please suggest if it needs any other settings or any other work around.

        J Offline
        J Offline
        Jochen Arndt
        wrote on last edited by
        #11

        As already mentioned: Focus on the very first error and ignore all others. The first three errors are in line number 53 of the file xyz.cpp. So you should show us the content of that line and the previous line(s) (at least the line before containing code skipping empty and comment only lines) together with the real error messages (or is 'somevariable' really used there?). To solve the error it may be also helpful to show us the declarations of any functions and types used in that lines that are not in the Windows header files (those decalred in your own or third party header files).

        S 2 Replies Last reply
        0
        • J Jochen Arndt

          As already mentioned: Focus on the very first error and ignore all others. The first three errors are in line number 53 of the file xyz.cpp. So you should show us the content of that line and the previous line(s) (at least the line before containing code skipping empty and comment only lines) together with the real error messages (or is 'somevariable' really used there?). To solve the error it may be also helpful to show us the declarations of any functions and types used in that lines that are not in the Windows header files (those decalred in your own or third party header files).

          S Offline
          S Offline
          Swap9
          wrote on last edited by
          #12

          It points to this code in XYZ.cpp : #ifdef __STDC__ DWORD WINAPI process( LPVOID Var1) #else DWORD WINAPI process( Var1) LPVOID Var1; #endif

          J 1 Reply Last reply
          0
          • S Swap9

            It points to this code in XYZ.cpp : #ifdef __STDC__ DWORD WINAPI process( LPVOID Var1) #else DWORD WINAPI process( Var1) LPVOID Var1; #endif

            J Offline
            J Offline
            Jochen Arndt
            wrote on last edited by
            #13

            Then blame the one who has written the code. What you need is

            DWORD WINAPI process( LPVOID Var1)

            That is valid C++ and C (including ANSI C). The second block is old style K&R C which is not used anymore since about 30 years. If such conditions are used all over your source files, you must remove the conditions and the second block.

            S 2 Replies Last reply
            0
            • J Jochen Arndt

              Then blame the one who has written the code. What you need is

              DWORD WINAPI process( LPVOID Var1)

              That is valid C++ and C (including ANSI C). The second block is old style K&R C which is not used anymore since about 30 years. If such conditions are used all over your source files, you must remove the conditions and the second block.

              S Offline
              S Offline
              Swap9
              wrote on last edited by
              #14

              yes, this code is ancient. I have not seen like this and everything seems reverse to me. I tried as you said, many errors are reduced. But this is everywhere in the codebase. #ifdef __STDC__ DWORD WINAPI ZI_process_monitor( LPVOID TA_arg ) //#else //DWORD WINAPI ZI_process_monitor( TA_arg ) // LPVOID TA_arg; #endif Now i get this one at many place including the beginning of the file : xyz.cpp(46) : error C2447: '{' : missing function header (old-style formal list?) xyz.cpp(96) : error C2447: '{' : missing function header (old-style formal list?)

              1 Reply Last reply
              0
              • J Jochen Arndt

                As already mentioned: Focus on the very first error and ignore all others. The first three errors are in line number 53 of the file xyz.cpp. So you should show us the content of that line and the previous line(s) (at least the line before containing code skipping empty and comment only lines) together with the real error messages (or is 'somevariable' really used there?). To solve the error it may be also helpful to show us the declarations of any functions and types used in that lines that are not in the Windows header files (those decalred in your own or third party header files).

                S Offline
                S Offline
                Swap9
                wrote on last edited by
                #15

                Yes the code is ancient, everything seems reverse to me. as you suggested i commented second block. #ifdef __STDC__ DWORD WINAPI process( LPVOID Var ) //#else //DWORD WINAPI process( var) // LPVOID var; #endif lot many errors are reduced, now what I get is: xyz.cpp(46) : error C2447: '{' : missing function header (old-style formal list?) xyz.cpp(46) : error C2447: '{' : missing function header (old-style formal list?) xyz.cpp(46) : error C2447: '{' : missing function header (old-style formal list?) xyz.cpp(46) : error C2059: syntax error : '}' xyz.cpp(46) : error C2143: syntax error : missing ';' before '}' xyz.cpp(196) : error C2059: syntax error : '}'

                J S 2 Replies Last reply
                0
                • S Swap9

                  Yes the code is ancient, everything seems reverse to me. as you suggested i commented second block. #ifdef __STDC__ DWORD WINAPI process( LPVOID Var ) //#else //DWORD WINAPI process( var) // LPVOID var; #endif lot many errors are reduced, now what I get is: xyz.cpp(46) : error C2447: '{' : missing function header (old-style formal list?) xyz.cpp(46) : error C2447: '{' : missing function header (old-style formal list?) xyz.cpp(46) : error C2447: '{' : missing function header (old-style formal list?) xyz.cpp(46) : error C2059: syntax error : '}' xyz.cpp(46) : error C2143: syntax error : missing ';' before '}' xyz.cpp(196) : error C2059: syntax error : '}'

                  J Offline
                  J Offline
                  Jochen Arndt
                  wrote on last edited by
                  #16

                  It should look like this:

                  //#ifdef __STDC__
                  DWORD WINAPI ZI_process_monitor( LPVOID TA_arg )
                  //#else
                  //DWORD WINAPI ZI_process_monitor( TA_arg )
                  // LPVOID TA_arg;
                  //#endif

                  when __STDC__ is not defined. Finally you should delete all commented lines.

                  S 2 Replies Last reply
                  0
                  • S Swap9

                    Yes the code is ancient, everything seems reverse to me. as you suggested i commented second block. #ifdef __STDC__ DWORD WINAPI process( LPVOID Var ) //#else //DWORD WINAPI process( var) // LPVOID var; #endif lot many errors are reduced, now what I get is: xyz.cpp(46) : error C2447: '{' : missing function header (old-style formal list?) xyz.cpp(46) : error C2447: '{' : missing function header (old-style formal list?) xyz.cpp(46) : error C2447: '{' : missing function header (old-style formal list?) xyz.cpp(46) : error C2059: syntax error : '}' xyz.cpp(46) : error C2143: syntax error : missing ';' before '}' xyz.cpp(196) : error C2059: syntax error : '}'

                    S Offline
                    S Offline
                    Swap9
                    wrote on last edited by
                    #17

                    #if n def __STDC__ DWORD WINAPI process( LPVOID Var ) //#else //DWORD WINAPI process( var) // LPVOID var; #endif it compiled with NO ERRORS. i changed #ifdef to #ifndef to execute DWORD WINAPI process( LPVOID Var ) part of the code - and no errors in compilations.

                    1 Reply Last reply
                    0
                    • J Jochen Arndt

                      It should look like this:

                      //#ifdef __STDC__
                      DWORD WINAPI ZI_process_monitor( LPVOID TA_arg )
                      //#else
                      //DWORD WINAPI ZI_process_monitor( TA_arg )
                      // LPVOID TA_arg;
                      //#endif

                      when __STDC__ is not defined. Finally you should delete all commented lines.

                      S Offline
                      S Offline
                      Swap9
                      wrote on last edited by
                      #18

                      Yes got it. absolutely. Thanks a ton Jochen

                      1 Reply Last reply
                      0
                      • J Jochen Arndt

                        It should look like this:

                        //#ifdef __STDC__
                        DWORD WINAPI ZI_process_monitor( LPVOID TA_arg )
                        //#else
                        //DWORD WINAPI ZI_process_monitor( TA_arg )
                        // LPVOID TA_arg;
                        //#endif

                        when __STDC__ is not defined. Finally you should delete all commented lines.

                        S Offline
                        S Offline
                        Swap9
                        wrote on last edited by
                        #19

                        my PQR.cpp file which was originally failing at ctype.h line#362 - #if !__STDC__ saying "Compiling...PQR.cpp include\ctype.h(362) : fatal error C1017: invalid integer constant expression for which i went on to fix file xyz.cpp, xyz.cpp got fixed when i undid my __STDC__ related changes and applied your suggestions but the old one PQR.cpp is still breaking with same error at same location :(( I applied your suggestions to PQR.CPP (The real file and real error for which i started all this) also thinking that if XYZ.CPP works PQR.cpp also should work, I can finally get rid of ctype.h but NOOO :(

                        J 1 Reply Last reply
                        0
                        • S Swap9

                          my PQR.cpp file which was originally failing at ctype.h line#362 - #if !__STDC__ saying "Compiling...PQR.cpp include\ctype.h(362) : fatal error C1017: invalid integer constant expression for which i went on to fix file xyz.cpp, xyz.cpp got fixed when i undid my __STDC__ related changes and applied your suggestions but the old one PQR.cpp is still breaking with same error at same location :(( I applied your suggestions to PQR.CPP (The real file and real error for which i started all this) also thinking that if XYZ.CPP works PQR.cpp also should work, I can finally get rid of ctype.h but NOOO :(

                          J Offline
                          J Offline
                          Jochen Arndt
                          wrote on last edited by
                          #20

                          Was ctype.h included before or did you add it? If you added it, remove the including. If it was there, check the line with the failure in ctype.h. Check also if the failing code is guarded by some preprocessor definition. A common error would be that some type or definition used by ctype.h is improperly defined somewhere in your header files. You may also move the including of ctype.h on top before inclduing any other file (except stdafx.h if used).

                          S 2 Replies Last reply
                          0
                          • J Jochen Arndt

                            Was ctype.h included before or did you add it? If you added it, remove the including. If it was there, check the line with the failure in ctype.h. Check also if the failing code is guarded by some preprocessor definition. A common error would be that some type or definition used by ctype.h is improperly defined somewhere in your header files. You may also move the including of ctype.h on top before inclduing any other file (except stdafx.h if used).

                            S Offline
                            S Offline
                            Swap9
                            wrote on last edited by
                            #21

                            it all began with __STDC__. I took the VS6 codebase dump and started compiling for that 1) lots of tagVariant related to fix that i removed __STDC__ from project properties. 2) now i stared getting syntax related error in my .cpp and .c files in thousands. 3) to remove that I added __STDC__ locally in some of the files like xyz.cpp 4)Then most of the files compiled but PQR.cpp and ABC.cpp gave an error failure in ctype.h at line 362 5)then I contacted you 6) I learnt about __STDC__ more in detail and removed __STDC__ from my files where ever i had added it to fix syntax errors and did the proper code fix with your help. 7)I am again back ctype.h file error in PQR and ABC .cpp files. I am trying what you are suggesting now...atleast that seems a right way to go...

                            1 Reply Last reply
                            0
                            • J Jochen Arndt

                              Was ctype.h included before or did you add it? If you added it, remove the including. If it was there, check the line with the failure in ctype.h. Check also if the failing code is guarded by some preprocessor definition. A common error would be that some type or definition used by ctype.h is improperly defined somewhere in your header files. You may also move the including of ctype.h on top before inclduing any other file (except stdafx.h if used).

                              S Offline
                              S Offline
                              Swap9
                              wrote on last edited by
                              #22

                              Wow...I could compile the project. :-D I do have lot of LINK errors but I will work on it. I learnt this "Use precompiled headers - stdafx.h. This must be the first include in your .cpp file." Changed the sequence of the .h files and I am all set now. Thanks a TON Jochen...you are awesome !! :rose:

                              J 1 Reply Last reply
                              0
                              • S Swap9

                                Wow...I could compile the project. :-D I do have lot of LINK errors but I will work on it. I learnt this "Use precompiled headers - stdafx.h. This must be the first include in your .cpp file." Changed the sequence of the .h files and I am all set now. Thanks a TON Jochen...you are awesome !! :rose:

                                J Offline
                                J Offline
                                Jochen Arndt
                                wrote on last edited by
                                #23

                                Fine that you finally solved all compiling errors.

                                1 Reply Last reply
                                0
                                • J Jochen Arndt

                                  Then blame the one who has written the code. What you need is

                                  DWORD WINAPI process( LPVOID Var1)

                                  That is valid C++ and C (including ANSI C). The second block is old style K&R C which is not used anymore since about 30 years. If such conditions are used all over your source files, you must remove the conditions and the second block.

                                  S Offline
                                  S Offline
                                  Swap9
                                  wrote on last edited by
                                  #24

                                  how can i get rid of lot of the below mentioned warnings : warning C4113: 'int (__cdecl *)()' differs in parameter lists from 'VAR1' ? Are they serious ?

                                  J 1 Reply Last reply
                                  0
                                  • S Swap9

                                    how can i get rid of lot of the below mentioned warnings : warning C4113: 'int (__cdecl *)()' differs in parameter lists from 'VAR1' ? Are they serious ?

                                    J Offline
                                    J Offline
                                    Jochen Arndt
                                    wrote on last edited by
                                    #25

                                    To get rid of the warning ensure that the parameter lists of the functions agree. If this is serious depends on the assignment. It is just a warning and the code will be compiled. But your application may crash when passing incompatible parameters. You should show the assignment and the definitions.

                                    S 1 Reply Last reply
                                    0
                                    • J Jochen Arndt

                                      To get rid of the warning ensure that the parameter lists of the functions agree. If this is serious depends on the assignment. It is just a warning and the code will be compiled. But your application may crash when passing incompatible parameters. You should show the assignment and the definitions.

                                      S Offline
                                      S Offline
                                      Swap9
                                      wrote on last edited by
                                      #26

                                      below given code in file 'some.c' --------------------------------

                                      #ifdef __STDC__
                                      static int fun1 ( struct1_inlistfile membervar1, void_pointerinlist_file membervar2 )
                                      #else

                                      static int fun1 (membervar1, membervar2)

                                      struct1_inlistfile membervar1;
                                      void_pointerinlist_file membervar2;

                                      #endif

                                      if the code is as above - I get this warning C4113: 'int (__cdecl *)()' differs in parameter lists from 'RECORDstructinlistheader' file if i comment the above code like you showed the other day the warning goes away. .h file has record defination in the form off struct. the 'some.c' file has another list class defination static RECORDstructinlistheader Listclass = { sizeof(RECORD), sizeof(element in record), add function , search function, /*This is the line where warning is pointed to */ pointer set, . . . I am afraid I am confusing, but I am giving much details to understand it correctly. pls help.

                                      J 1 Reply Last reply
                                      0
                                      • S Swap9

                                        below given code in file 'some.c' --------------------------------

                                        #ifdef __STDC__
                                        static int fun1 ( struct1_inlistfile membervar1, void_pointerinlist_file membervar2 )
                                        #else

                                        static int fun1 (membervar1, membervar2)

                                        struct1_inlistfile membervar1;
                                        void_pointerinlist_file membervar2;

                                        #endif

                                        if the code is as above - I get this warning C4113: 'int (__cdecl *)()' differs in parameter lists from 'RECORDstructinlistheader' file if i comment the above code like you showed the other day the warning goes away. .h file has record defination in the form off struct. the 'some.c' file has another list class defination static RECORDstructinlistheader Listclass = { sizeof(RECORD), sizeof(element in record), add function , search function, /*This is the line where warning is pointed to */ pointer set, . . . I am afraid I am confusing, but I am giving much details to understand it correctly. pls help.

                                        J Offline
                                        J Offline
                                        Jochen Arndt
                                        wrote on last edited by
                                        #27

                                        So you did not get the warning when removing the __STDC__ stuff? Then its should be OK. To resolve the error check the declaration of search_function and the corresponding RECORDstructinlistheader structure member (structure definition in some header file).

                                        S 2 Replies Last reply
                                        0
                                        • J Jochen Arndt

                                          So you did not get the warning when removing the __STDC__ stuff? Then its should be OK. To resolve the error check the declaration of search_function and the corresponding RECORDstructinlistheader structure member (structure definition in some header file).

                                          S Offline
                                          S Offline
                                          Swap9
                                          wrote on last edited by
                                          #28

                                          right no warnings when removing __STDC__ stuff. I am trying to resolve where is that disagreement happening - but I am confused looking what is the meaning of these four statement ?

                                          typedef int (*p)(void *, void *);

                                          typedef void *P;

                                          typedef void* P;

                                          typedef void* (*p)();

                                          J 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