Thread: compiling C code at visual C++ 6.0

  1. #1
    Registered User
    Join Date
    Jan 2008
    Posts
    2

    Unhappy compiling C code at visual C++ 6.0

    hi, when i compile my c code at visual C++ 6.0, i got some errors and i can't fix it, please help..

    my C file uses the unistd.h and the code is
    Code:
    /* This is defined as a real library function to allow autoconf
       to verify its existence. */
    int ftruncate(int, off_t);
    __CRT_INLINE int ftruncate(int __fd, off_t __length)
    {
      return _chsize (__fd, __length);
    }
    errors:
    error C2081: 'off_t' : name in formal parameter list illegal
    error C2054: expected '(' to follow '__CRT_INLINE'
    error C2146: syntax error : missing ')' before identifier '__length'
    error C2081: 'off_t' : name in formal parameter list illegal
    error C2082: redefinition of formal parameter 'ftruncate'
    error C2146: syntax error : missing ',' before identifier '__length'
    error C2059: syntax error : ')'
    error C2143: syntax error : missing ';' before '{'

  2. #2
    Jack of many languages Dino's Avatar
    Join Date
    Nov 2007
    Location
    Chappell Hill, Texas
    Posts
    2,332
    That appears to be a cut and paste from compiler generated code. Can you post your source code?

  3. #3
    Registered User
    Join Date
    Jan 2008
    Posts
    2
    Quote Originally Posted by Todd Burch View Post
    That appears to be a cut and paste from compiler generated code. Can you post your source code?
    unistd.h source code:

    Code:
    /*
     * This file is part of the Mingw32 package.
     *
     * unistd.h maps (roughly) to io.h
     */
    
    #ifndef _UNISTD_H
    #define _UNISTD_H
    
    #include <io.h>
    #include <process.h>
    
    #define __UNISTD_GETOPT__
    #include <getopt.h>
    #undef __UNISTD_GETOPT__
    
    #ifdef __cplusplus
    extern "C" {
    #endif
    
    /* This is defined as a real library function to allow autoconf
       to verify its existence. */
    int ftruncate(int, off_t);
    __CRT_INLINE int ftruncate(int __fd, off_t __length)
    {
      return _chsize (__fd, __length);
    }
    
    #ifdef __cplusplus
    }
    #endif
    
    #endif /* _UNISTD_H */

  4. #4
    Jack of many languages Dino's Avatar
    Join Date
    Nov 2007
    Location
    Chappell Hill, Texas
    Posts
    2,332
    No, not the header - the code YOU wrote!!

  5. #5
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Quote Originally Posted by hattusili View Post
    my C file uses the unistd.h
    unistd.h is a UNIX header, not a Windows header.

  6. #6
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by cpjust View Post
    unistd.h is a UNIX header, not a Windows header.
    MinGW provides it, but I have no idea how will it works, if at all.

  7. #7
    Registered User
    Join Date
    Apr 2006
    Posts
    83
    thread Stoped !!!!!

  8. #8
    Registered User
    Join Date
    Dec 2007
    Posts
    2,675
    Quote Originally Posted by RahulDhanpat View Post
    thread Stoped !!!!!
    Hammertime!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. ras.h errors
    By Trent_Easton in forum Windows Programming
    Replies: 8
    Last Post: 07-15-2005, 10:52 PM
  2. Problem with Visual C++ 6.0
    By toonlover in forum C++ Programming
    Replies: 4
    Last Post: 05-25-2005, 09:32 PM
  3. How to Clear in Visual C++ 6.0
    By MyDestiny in forum Windows Programming
    Replies: 1
    Last Post: 03-16-2005, 11:57 AM
  4. Compiling in Unix vs Visual C++
    By stimpyzu in forum C++ Programming
    Replies: 2
    Last Post: 09-30-2002, 06:41 AM
  5. Microsoft Visual C++ 6.0 ** Am I missing something?
    By Intimd8r in forum C Programming
    Replies: 9
    Last Post: 05-15-2002, 03:21 AM