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. error C2143: syntax error: missing ':' before 'constant'

error C2143: syntax error: missing ':' before 'constant'

Scheduled Pinned Locked Moved C / C++ / MFC
help
10 Posts 6 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.
  • F Offline
    F Offline
    ForNow
    wrote on last edited by
    #1

    I am getting an error in a windows include winioctl.h

    typedef union {
    USN_RECORD_COMMON_HEADER Header;
    USN_RECORD_V2 V2; <===
    USN_RECORD_V3 V3; <===
    USN_RECORD_V4 V4; <====
    } USN_RECORD_UNION, *PUSN_RECORD_UNION;

    for the 3 lines pointed to by the errors the code built find with the windows sdk 8 I migrated the application to windows 10 and am using the windows 10 sdk Thanks

    D L J 3 Replies Last reply
    0
    • F ForNow

      I am getting an error in a windows include winioctl.h

      typedef union {
      USN_RECORD_COMMON_HEADER Header;
      USN_RECORD_V2 V2; <===
      USN_RECORD_V3 V3; <===
      USN_RECORD_V4 V4; <====
      } USN_RECORD_UNION, *PUSN_RECORD_UNION;

      for the 3 lines pointed to by the errors the code built find with the windows sdk 8 I migrated the application to windows 10 and am using the windows 10 sdk Thanks

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      ForNow wrote:

      ...for the 3 lines pointed to by the errors...

      And that error would be what?

      "One man's wage rise is another man's price increase." - Harold Wilson

      "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

      "You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles

      F 1 Reply Last reply
      0
      • D David Crow

        ForNow wrote:

        ...for the 3 lines pointed to by the errors...

        And that error would be what?

        "One man's wage rise is another man's price increase." - Harold Wilson

        "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

        "You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles

        F Offline
        F Offline
        ForNow
        wrote on last edited by
        #3

        C2143 syntax error missing ':' before constant the error might make sense if

        USN_RECORD_COMMON_HEADER

        wasn't defined but it is a few lines above

        P V 2 Replies Last reply
        0
        • F ForNow

          C2143 syntax error missing ':' before constant the error might make sense if

          USN_RECORD_COMMON_HEADER

          wasn't defined but it is a few lines above

          P Offline
          P Offline
          Peter_in_2780
          wrote on last edited by
          #4

          But are USN_RECORD_V2 USN_RECORD_V3 USN_RECORD_V4 defined? That's where I'd look, given your original error messages.

          Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012

          F 1 Reply Last reply
          0
          • F ForNow

            C2143 syntax error missing ':' before constant the error might make sense if

            USN_RECORD_COMMON_HEADER

            wasn't defined but it is a few lines above

            V Offline
            V Offline
            Victor Nijegorodov
            wrote on last edited by
            #5

            ForNow wrote:

            C2143 syntax error missing ':' before constant the error might make sense if

            USN_RECORD_COMMON_HEADER

            wasn't defined but it is a few lines above

            Could you post these "few lines"?

            F 1 Reply Last reply
            0
            • F ForNow

              I am getting an error in a windows include winioctl.h

              typedef union {
              USN_RECORD_COMMON_HEADER Header;
              USN_RECORD_V2 V2; <===
              USN_RECORD_V3 V3; <===
              USN_RECORD_V4 V4; <====
              } USN_RECORD_UNION, *PUSN_RECORD_UNION;

              for the 3 lines pointed to by the errors the code built find with the windows sdk 8 I migrated the application to windows 10 and am using the windows 10 sdk Thanks

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

              Have a look in Winioctl.h to check the definitions of these types. My version compiles them fine on VS2017 and Windows 10.

              1 Reply Last reply
              0
              • F ForNow

                I am getting an error in a windows include winioctl.h

                typedef union {
                USN_RECORD_COMMON_HEADER Header;
                USN_RECORD_V2 V2; <===
                USN_RECORD_V3 V3; <===
                USN_RECORD_V4 V4; <====
                } USN_RECORD_UNION, *PUSN_RECORD_UNION;

                for the 3 lines pointed to by the errors the code built find with the windows sdk 8 I migrated the application to windows 10 and am using the windows 10 sdk Thanks

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

                Check the typedefs of the three structures that fail for mutual non standard members. A candidate is the USN member. Do you have a define directive using the same name anywhere in your project? If that does not help enable the creation of preprocessor output files. Then you can check what the compiler "sees".

                F 1 Reply Last reply
                0
                • V Victor Nijegorodov

                  ForNow wrote:

                  C2143 syntax error missing ':' before constant the error might make sense if

                  USN_RECORD_COMMON_HEADER

                  wasn't defined but it is a few lines above

                  Could you post these "few lines"?

                  F Offline
                  F Offline
                  ForNow
                  wrote on last edited by
                  #8

                  Here is the definition USN_RECORD_COMMON_HEADER

                  typedef struct {
                  DWORD RecordLength;
                  WORD MajorVersion;
                  WORD MinorVersion;
                  } USN_RECORD_COMMON_HEADER, *PUSN_RECORD_COMMON_HEADER;

                  1 Reply Last reply
                  0
                  • P Peter_in_2780

                    But are USN_RECORD_V2 USN_RECORD_V3 USN_RECORD_V4 defined? That's where I'd look, given your original error messages.

                    Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012

                    F Offline
                    F Offline
                    ForNow
                    wrote on last edited by
                    #9

                    typedef USN_RECORD_V2 USN_RECORD, *PUSN_RECORD;

                    typedef struct {

                    DWORD RecordLength;
                    WORD   MajorVersion;
                    WORD   MinorVersion;
                    FILE\_ID\_128 FileReferenceNumber;
                    FILE\_ID\_128 ParentFileReferenceNumber;
                    USN Usn;
                    LARGE\_INTEGER TimeStamp;
                    DWORD Reason;
                    DWORD SourceInfo;
                    DWORD SecurityId;
                    DWORD FileAttributes;
                    WORD   FileNameLength;
                    WORD   FileNameOffset;
                    WCHAR FileName\[1\];
                    

                    } USN_RECORD_V3, *PUSN_RECORD_V3;

                    ypedef struct {
                    USN_RECORD_COMMON_HEADER Header;
                    FILE_ID_128 FileReferenceNumber;
                    FILE_ID_128 ParentFileReferenceNumber;
                    USN Usn;
                    DWORD Reason;
                    DWORD SourceInfo;
                    DWORD RemainingExtents;
                    WORD NumberOfExtents;
                    WORD ExtentSize;
                    USN_RECORD_EXTENT Extents[1];
                    } USN_RECORD_V4, *PUSN_RECORD_V4;

                    1 Reply Last reply
                    0
                    • J Jochen Arndt

                      Check the typedefs of the three structures that fail for mutual non standard members. A candidate is the USN member. Do you have a define directive using the same name anywhere in your project? If that does not help enable the creation of preprocessor output files. Then you can check what the compiler "sees".

                      F Offline
                      F Offline
                      ForNow
                      wrote on last edited by
                      #10

                      THANKS

                      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