0

I'm trying to build a project in VS2008 but I'm getting the following errors:

Error   1   error C2143: syntax error : missing ';' before '['
    C:\Program Files\Microsoft Visual Studio 9.0\VC\include\io.h    185 lmlib
.
.
.
Error   7   error C2143: syntax error : missing ';' before 'type'
    C:\Program Files\Microsoft Visual Studio 9.0\VC\include\io.h    192 lmlib

This project works fine in VS2005, but why it doesn't work VS2008? Im attaching io.h file ,pls help me how to resolve these errors

 #if _MSC_VER > 1000
    #pragma once
    #endif

    #ifndef _INC_IO
    #define _INC_IO

    #include <crtdefs.h>

    #ifdef  _MSC_VER
    /*
     * Currently, all MS C compilers for Win32 platforms default to 8 byte
     * alignment.
     */
    #pragma pack(push,_CRT_PACKING)
    #endif  /* _MSC_VER */

    #ifndef _POSIX_

    #ifdef  __cplusplus
    extern "C" {
    #endif

    #ifndef _FSIZE_T_DEFINED
    typedef unsigned long _fsize_t; /* Could be 64 bits for Win32 */
    #define _FSIZE_T_DEFINED
    #endif

    #ifndef _FINDDATA_T_DEFINED

    struct _finddata32_t {
        unsigned    attrib;
        __time32_t  time_create;    /* -1 for FAT file systems */
        __time32_t  time_access;    /* -1 for FAT file systems */
        __time32_t  time_write;
        _fsize_t    size;
        char        name[260];
    };

    struct _finddata32i64_t {
        unsigned    attrib;
        __time32_t  time_create;    /* -1 for FAT file systems */
        __time32_t  time_access;    /* -1 for FAT file systems */
        __time32_t  time_write;
        __int64     size;
        char        name[260];
    };

    struct _finddata64i32_t {
        unsigned    attrib;
        __time64_t  time_create;    /* -1 for FAT file systems */
        __time64_t  time_access;    /* -1 for FAT file systems */
        __time64_t  time_write;
        _fsize_t    size;
        char        name[260];
    };

    struct __finddata64_t {
        unsigned    attrib;
        __time64_t  time_create;    /* -1 for FAT file systems */
        __time64_t  time_access;    /* -1 for FAT file systems */
        __time64_t  time_write;
        __int64     size;
        char        name[260];
    };

    #ifdef _USE_32BIT_TIME_T
    #define _finddata_t     _finddata32_t
    #define _finddatai64_t  _finddata32i64_t

    #define _findfirst      _findfirst32
    #define _findnext       _findnext32
    #define _findfirsti64   _findfirst32i64
    #define _findnexti64     _findnext32i64

    #else
    #define _finddata_t     _finddata64i32_t
    #define _finddatai64_t  __finddata64_t

    #define _findfirst      _findfirst64i32
    #define _findnext       _findnext64i32
    #define _findfirsti64   _findfirst64
    #define _findnexti64    _findnext64

    #endif


    #define _FINDDATA_T_DEFINED
    #endif

    #ifndef _WFINDDATA_T_DEFINED

    struct _wfinddata32_t {
        unsigned    attrib;
        __time32_t  time_create;    /* -1 for FAT file systems */
        __time32_t  time_access;    /* -1 for FAT file systems */
        __time32_t  time_write;
        _fsize_t    size;
        wchar_t     name[260];
    };

    struct _wfinddata32i64_t {
        unsigned    attrib;
        __time32_t  time_create;    /* -1 for FAT file systems */
        __time32_t  time_access;    /* -1 for FAT file systems */
        __time32_t  time_write;
        __int64     size;
        wchar_t     name[260];
    };

    struct _wfinddata64i32_t {
        unsigned    attrib;
        __time64_t  time_create;    /* -1 for FAT file systems */
        __time64_t  time_access;    /* -1 for FAT file systems */
        __time64_t  time_write;
        _fsize_t    size;
        wchar_t     name[260];
    };

    struct _wfinddata64_t {
        unsigned    attrib;
        __time64_t  time_create;    /* -1 for FAT file systems */
        __time64_t  time_access;    /* -1 for FAT file systems */
        __time64_t  time_write;
        __int64     size;
        wchar_t     name[260];
    };

    #ifdef _USE_32BIT_TIME_T
    #define _wfinddata_t    _wfinddata32_t
    #define _wfinddatai64_t _wfinddata32i64_t

    #define _wfindfirst     _wfindfirst32
    #define _wfindnext      _wfindnext32
    #define _wfindfirsti64  _wfindfirst32i64
    #define _wfindnexti64   _wfindnext32i64

    #else                  
    #define _wfinddata_t    _wfinddata64i32_t
    #define _wfinddatai64_t _wfinddata64_t

    #define _wfindfirst     _wfindfirst64i32
    #define _wfindnext      _wfindnext64i32
    #define _wfindfirsti64  _wfindfirst64
    #define _wfindnexti64   _wfindnext64

    #endif

    #define _WFINDDATA_T_DEFINED
    #endif

    /* File attribute constants for _findfirst() */

    #define _A_NORMAL       0x00    /* Normal file - No read/write restrictions */
    #define _A_RDONLY       0x01    /* Read only file */
    #define _A_HIDDEN       0x02    /* Hidden file */
    #define _A_SYSTEM       0x04    /* System file */
    #define _A_SUBDIR       0x10    /* Subdirectory */
    #define _A_ARCH         0x20    /* Archive file */

    /* function prototypes */

    #ifndef _SIZE_T_DEFINED
    #ifdef  _WIN64
    typedef unsigned __int64    size_t;
    #else
    typedef _W64 unsigned int   size_t;
    #endif
    #define _SIZE_T_DEFINED
    #endif
    //from this line onwards i got errors//
    _Check_return_ _CRTIMP int __cdecl _access(_In_z_ const char * _Filename, _In_ int      _AccessMode);
    _Check_return_wat_ _CRTIMP errno_t __cdecl _access_s(_In_z_ const char * _Filename,     _In_ int _AccessMode);
    _Check_return_ _CRTIMP int __cdecl _chmod(_In_z_ const char * _Filename, _In_ int   _Mode);
    /* note that the newly added _chsize_s takes a 64 bit value */
    _Check_return_ _CRTIMP int __cdecl _chsize(_In_ int _FileHandle, _In_ long _Size);
    _Check_return_wat_ _CRTIMP errno_t __cdecl _chsize_s(_In_ int _FileHandle,_In_ __int64   _Size);
    _Check_return_opt_ _CRTIMP int __cdecl _close(_In_ int _FileHandle);
    _Check_return_opt_ _CRTIMP int __cdecl _commit(_In_ int _FileHandle);
    _Check_return_ _CRT_INSECURE_DEPRECATE(_sopen_s) _CRTIMP int __cdecl _creat(_In_z_   const char * _Filename, _In_ int _PermissionMode);
    _Check_return_ _CRTIMP int __cdecl _dup(_In_ int _FileHandle);
    _Check_return_ _CRTIMP int __cdecl _dup2(_In_ int _FileHandleSrc, _In_ int  _FileHandleDst);
    _Check_return_ _CRTIMP int __cdecl _eof(_In_ int _FileHandle);
    _Check_return_ _CRTIMP long __cdecl _filelength(_In_ int _FileHandle);
    _Check_return_ _CRTIMP intptr_t __cdecl _findfirst32(_In_z_ const char * _Filename,   _Out_ struct _finddata32_t * _FindData);
    _Check_return_ _CRTIMP int __cdecl _findnext32(_In_ intptr_t _FindHandle, _Out_ struct   _finddata32_t * _FindData);
    _Check_return_opt_ _CRTIMP int __cdecl _findclose(_In_ intptr_t _FindHandle);
    _Check_return_ _CRTIMP int __cdecl _isatty(_In_ int _FileHandle);
    _CRTIMP int __cdecl _locking(_In_ int _FileHandle, _In_ int _LockMode, _In_ long   _NumOfBytes);
    _Check_return_opt_ _CRTIMP long __cdecl _lseek(_In_ int _FileHandle, _In_ long _Offset, _In_ int _Origin);
    _Check_return_wat_ _CRTIMP errno_t __cdecl _mktemp_s(_Inout_z_cap_(_Size) char * _TemplateName, _In_ size_t _Size);
   __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_0(errno_t, _mktemp_s, _Deref_prepost_z_ char,  _TemplateName)
    _Check_return_ __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_0(char *, __RETURN_POLICY_DST,  _CRTIMP, _mktemp, _Inout_z_, char, _TemplateName)
    _Check_return_ _CRTIMP int __cdecl _pipe(_Inout_cap_c_(2) int * _PtHandles, _In_  unsigned int _PipeSize, _In_ int _TextMode);
    _Check_return_ _CRTIMP int __cdecl _read(_In_ int _FileHandle, _Out_bytecap_(_MaxCharCount) void * _DstBuf, _In_ unsigned int _MaxCharCount);

    #ifndef _CRT_DIRECTORY_DEFINED
    #define _CRT_DIRECTORY_DEFINED
    _Check_return_ _CRTIMP int __cdecl remove(_In_z_ const char * _Filename);
    _Check_return_ _CRTIMP int __cdecl rename(_In_z_ const char * _OldFilename, _In_z_   const char * _NewFilename);
    _Check_return_ _CRTIMP int __cdecl _unlink(_In_z_ const char * _Filename);
    #if !__STDC__
    _Check_return_ _CRT_NONSTDC_DEPRECATE(_unlink) _CRTIMP int __cdecl unlink(_In_z_ const  char * _Filename);
    #endif
    #endif

    _Check_return_ _CRTIMP int __cdecl _setmode(_In_ int _FileHandle, _In_ int _Mode);
    _Check_return_ _CRTIMP long __cdecl _tell(_In_ int _FileHandle);
    _CRT_INSECURE_DEPRECATE(_umask_s) _CRTIMP int __cdecl _umask(_In_ int _Mode);
    _Check_return_wat_ _CRTIMP errno_t __cdecl _umask_s(_In_ int _NewMode, _Out_ int *   _OldMode);
    _CRTIMP int __cdecl _write(_In_ int _FileHandle, _In_bytecount_(_MaxCharCount) const       void * _Buf, _In_ unsigned int _MaxCharCount);

    _Check_return_ _CRTIMP __int64 __cdecl _filelengthi64(_In_ int _FileHandle);
    _Check_return_ _CRTIMP intptr_t __cdecl _findfirst32i64(_In_z_ const char * _Filename,     _Out_ struct _finddata32i64_t * _FindData);
    _Check_return_ _CRTIMP intptr_t __cdecl _findfirst64i32(_In_z_ const char * _Filename,   _Out_ struct _finddata64i32_t * _FindData);
    _Check_return_ _CRTIMP intptr_t __cdecl _findfirst64(_In_z_ const char * _Filename,   _Out_ struct __finddata64_t * _FindData);
    _Check_return_ _CRTIMP int __cdecl _findnext32i64(_In_ intptr_t _FindHandle, _Out_  struct _finddata32i64_t * _FindData);
    _Check_return_ _CRTIMP int __cdecl _findnext64i32(_In_ intptr_t _FindHandle, _Out_   struct _finddata64i32_t * _FindData);
    _Check_return_ _CRTIMP int __cdecl _findnext64(_In_ intptr_t _FindHandle, _Out_ struct  __finddata64_t * _FindData);
    _Check_return_opt_ _CRTIMP __int64 __cdecl _lseeki64(_In_ int _FileHandle, _In_ __int64  _Offset, _In_ int _Origin);
    _Check_return_ _CRTIMP __int64 __cdecl _telli64(_In_ int _FileHandle);

    _Check_return_wat_ _CRTIMP errno_t __cdecl _sopen_s(_Out_ int * _FileHandle, _In_z_  const char * _Filename,_In_ int _OpenFlag, _In_ int _ShareFlag, _In_ int _PermissionMode);

    #if !defined(__cplusplus)
    _Check_return_ _CRT_INSECURE_DEPRECATE(_sopen_s) _CRTIMP int __cdecl _open(_In_z_ const  char * _Filename, _In_ int _OpenFlag, ...);
    _Check_return_ _CRT_INSECURE_DEPRECATE(_sopen_s) _CRTIMP int __cdecl _sopen(_In_z_  const char * _Filename, _In_ int _OpenFlag, int _ShareFlag, ...);
    #else

    /* these function do not validate pmode; use _sopen_s */
    extern "C++" _Check_return_ _CRT_INSECURE_DEPRECATE(_sopen_s) _CRTIMP int __cdecl   _open(_In_z_ const char * _Filename, _In_ int _Openflag, _In_ int _PermissionMode = 0);
    extern "C++" _Check_return_ _CRT_INSECURE_DEPRECATE(_sopen_s) _CRTIMP int __cdecl   _sopen(_In_z_ const char * _Filename, _In_ int _Openflag, _In_ int _ShareFlag, _In_ int   _PermissionMode = 0);

    #endif

    #ifndef _WIO_DEFINED

    /* wide function prototypes, also declared in wchar.h  */

    _Check_return_ _CRTIMP int __cdecl _waccess(_In_z_ const wchar_t * _Filename, _In_ int  _AccessMode);
    _Check_return_wat_ _CRTIMP errno_t __cdecl _waccess_s(_In_z_ const wchar_t * _Filename, _In_ int _AccessMode);
    _Check_return_ _CRTIMP int __cdecl _wchmod(_In_z_ const wchar_t * _Filename, _In_ int _Mode);
    _Check_return_ _CRT_INSECURE_DEPRECATE(_wsopen_s) _CRTIMP int __cdecl _wcreat(_In_z_ const wchar_t * _Filename, _In_ int _PermissionMode);
    _Check_return_ _CRTIMP intptr_t __cdecl _wfindfirst32(_In_z_ const wchar_t * _Filename,  _Out_ struct _wfinddata32_t * _FindData);
    _Check_return_ _CRTIMP int __cdecl _wfindnext32(_In_ intptr_t _FindHandle, _Out_ struct  _wfinddata32_t * _FindData);
    _Check_return_ _CRTIMP int __cdecl _wunlink(_In_z_ const wchar_t * _Filename);
    _Check_return_ _CRTIMP int __cdecl _wrename(_In_z_ const wchar_t * _OldFilename, _In_z_  const wchar_t * _NewFilename);
    _CRTIMP errno_t __cdecl _wmktemp_s(_Inout_z_cap_(_SizeInWords) wchar_t * _TemplateName,  _In_ size_t _SizeInWords);
    __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_0(errno_t, _wmktemp_s, _Deref_prepost_z_ wchar_t,  _TemplateName)
   __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_0(wchar_t *, __RETURN_POLICY_DST, _CRTIMP,  _wmktemp, _Inout_z_, wchar_t, _TemplateName)

    _Check_return_ _CRTIMP intptr_t __cdecl _wfindfirst32i64(_In_z_ const wchar_t *   _Filename, _Out_ struct _wfinddata32i64_t * _FindData);
    _Check_return_ _CRTIMP intptr_t __cdecl _wfindfirst64i32(_In_z_ const wchar_t * _Filename, _Out_ struct _wfinddata64i32_t * _FindData);
    _Check_return_ _CRTIMP intptr_t __cdecl _wfindfirst64(_In_z_ const wchar_t * _Filename,  _Out_ struct _wfinddata64_t * _FindData);
    _Check_return_ _CRTIMP int __cdecl _wfindnext32i64(_In_ intptr_t _FindHandle, _Out_  struct _wfinddata32i64_t * _FindData);
    _Check_return_ _CRTIMP int __cdecl _wfindnext64i32(_In_ intptr_t _FindHandle, _Out_  struct _wfinddata64i32_t * _FindData);
    _Check_return_ _CRTIMP int __cdecl _wfindnext64(_In_ intptr_t _FindHandle, _Out_ struct  _wfinddata64_t * _FindData);

    _Check_return_wat_ _CRTIMP errno_t __cdecl _wsopen_s(_Out_ int * _FileHandle, _In_z_  const wchar_t * _Filename, _In_ int _OpenFlag, _In_ int _ShareFlag, _In_ int _PermissionFlag);

    #if !defined(__cplusplus) || !defined(_M_IX86)

    _Check_return_ _CRT_INSECURE_DEPRECATE(_wsopen_s) _CRTIMP int __cdecl _wopen(_In_z_  const wchar_t * _Filename, _In_ int _OpenFlag, ...);
    _Check_return_ _CRT_INSECURE_DEPRECATE(_wsopen_s) _CRTIMP int __cdecl _wsopen(_In_z_   const wchar_t * _Filename, _In_ int _OpenFlag, int _ShareFlag, ...);

    #else

    /* these function do not validate pmode; use _sopen_s */
    extern "C++" _CRT_INSECURE_DEPRECATE(_wsopen_s) _CRTIMP int __cdecl _wopen(_In_z_ const  wchar_t * _Filename, _In_ int _OpenFlag, _In_ int _PermissionMode = 0);
    extern "C++" _CRT_INSECURE_DEPRECATE(_wsopen_s) _CRTIMP int __cdecl _wsopen(_In_z_  const wchar_t * _Filename, _In_ int _OpenFlag, _In_ int _ShareFlag, int _PermissionMode =  0);

    #endif

    #define _WIO_DEFINED
    #endif

    int  __cdecl __lock_fhandle(_In_ int _Filehandle);
    void __cdecl _unlock_fhandle(_In_ int _Filehandle);
user1448763
  • 11
  • 1
  • 4
  • Looks like a syntax error in your code may be you are using some macro that needs a ; or you have a missing ; at the end of your class – Neel Basu Jan 23 '13 at 11:44
  • Got any **code** to go with this question? – WhozCraig Jan 23 '13 at 11:44
  • hi Neel Basu thanks for ur reply, i checked every class in io.h file ,every class contain ;. – user1448763 Jan 23 '13 at 11:50
  • 1
    The error is not in `io.h`, that will be fine. There is no reason to look for syntax errors in the standard files. The error is at where you use it. Or in a file that is used with `io.h` in a third file. – Csq Jan 23 '13 at 11:52
  • 1
    Try to reduce your code to a [SSCCE](http://sscce.org/) that reproduces the error, then post the code here. – Angew is no longer proud of SO Jan 23 '13 at 12:37
  • Looking further it is apparent it may be caused by SAL annotation syntax not being valid due to conflict or you havn't closed the scope. You need to check your code as Neel Basu said for a missing ';' or '}', not the io.h. If you are using SAL yourself refer to http://stackoverflow.com/questions/652542/strange-sal-annotation-warning as the syntax changed a little in vc2008 – Crog Jan 24 '13 at 09:13

2 Answers2

1

hard to tell without some code to work of, maybe you missed a semi-colon after the end of a class declaration in one header then when the io.h is being included its complaining about it. Stab in the dark i'm sorry.

rfcoder89
  • 184
  • 10
  • Hi thanks for ur reply@rfcoder89,i checked io.h file ,every class ends with a semi-colon ,i attached io.h file ,help me how to solve these errors – user1448763 Jan 24 '13 at 08:49
-2

You may need to download a newer Windows SDK which was formerly Platform SDK.

EDIT: to elaborate there are some differences when moving to the newer vc2008. I had some issues which were rectified when I moved to vc2008 from vc2005 that an updated sdk solved. I do not say there is an error in the standard headers just there were mismatches between an older SDK and the headers within vc2008. Without seeing more code it is difficult to say but you cannot eliminate this as a potential solution from what the OP has stated.

I should also add for the OP that updating to a new SDK will still function normally within vc2005, you will probably need to run the "Windows SDK Configuration Tool" to set the newer SDK up within visual studio too if you were to need to attempt this.

Crog
  • 1,112
  • 8
  • 16
  • -1. You cant blame the standard library without first seeing the code that uses it. The likelihood that this problem is in the standard library is vanishingly small. – Pete Becker Jan 23 '13 at 13:48
  • I have experienced a similar problem when migrating to vc2008. As the OP states he has moved form vc2005 to vc2008 this is a possible solution that is defiantly worth trying as could save hours of hunting down a non-issue. I am not saying it is not a code issue, its worth trying every avenue for this sort of issue especially when this error points at a parsing error in the headers. – Crog Jan 23 '13 at 14:36
  • Replacing the standard library is a sledge hammer, and shouldn't be done unless there is a **good reason** to think it is the culprit. With no code to examine, it's definitely not an appropriate recommendation. – Pete Becker Jan 23 '13 at 15:00
  • Without code to examine, as I mention in my edit this, is a potential thing the OP 'may' try. I assume the OP has intelligence and is checking his/her code and it is worth them knowing that the issue could lay in the MS court which is easily eliminated as an issue by possibly first updating the SDK if they are at a point of ripping hair out. – Crog Jan 23 '13 at 15:23
  • Hi Thanks for ur reply @user876651 ,i installed windows SDK but same errors came , how can i resolve these errors ,pls anyone help me,thanks in advance – user1448763 Jan 24 '13 at 08:44