resolving types

Discussion in 'C Programming' started by cs1975@gmail.com, Aug 24, 2007.

  1. Guest

    hi all,

    I was trying to compile a test.c using Microsoft CL compiler with
    command line , I end up in errors in resolving standard types

    unsigned char
    char
    int

    I searched documentation, I did not able to figure out which is
    "Header file", which I need to include to resolve these types.

    regards,
    chandra-
     
    , Aug 24, 2007
    #1
    1. Advertising

  2. Mark Bluemel Guest

    wrote:
    > hi all,
    >
    > I was trying to compile a test.c using Microsoft CL compiler with
    > command line , I end up in errors in resolving standard types
    >
    > unsigned char
    > char
    > int
    >
    > I searched documentation, I did not able to figure out which is
    > "Header file", which I need to include to resolve these types.


    These types are part of the _language_ so require no headers. Your
    problem is not related to headers.

    It would probably be worth you showing us your code, ideally cut down to
    the smallest program which demonstrates your problem.

    You should also show us the error messages from your compiler.

    For both code and error messages, use "cut and paste" to show us the
    real things, rather than transcribing by hand or telling us
    approximately what they look like.
     
    Mark Bluemel, Aug 24, 2007
    #2
    1. Advertising

  3. Chris Dollin Guest

    wrote:

    > I was trying to compile a test.c using Microsoft CL compiler with
    > command line , I end up in errors in resolving standard types
    >
    > unsigned char
    > char
    > int


    I think that's /very/ unlikely. If your compiler is a C compiler,
    then it doesn't need to do anything to "resolve" standard types
    (and "resolve" isn't the term I'd expect a C compiler to use);
    they're hard-wired in to the syntax.

    Exactly what did you write and exactly what were the messages?

    > I searched documentation, I did not able to figure out which is
    > "Header file", which I need to include to resolve these types.


    You don't.

    --
    Chris "SHOW. CODE." Dollin

    Hewlett-Packard Limited Cain Road, Bracknell, registered no:
    registered office: Berks RG12 1HN 690597 England
     
    Chris Dollin, Aug 24, 2007
    #3
  4. santosh Guest

    wrote:

    > hi all,
    >
    > I was trying to compile a test.c using Microsoft CL compiler with
    > command line , I end up in errors in resolving standard types
    >
    > unsigned char
    > char
    > int
    >
    > I searched documentation, I did not able to figure out which is
    > "Header file", which I need to include to resolve these types.


    Show us the code that failed to compile. Cut and paste, don't retype. Either
    you're not understanding your problem, or your compiler is seriously
    broken.
     
    santosh, Aug 24, 2007
    #4
  5. Army1987 Guest

    On Fri, 24 Aug 2007 01:56:04 -0700, cs1975 wrote:

    > hi all,
    >
    > I was trying to compile a test.c using Microsoft CL compiler with
    > command line , I end up in errors in resolving standard types
    >
    > unsigned char
    > char
    > int
    >
    > I searched documentation, I did not able to figure out which is
    > "Header file", which I need to include to resolve these types.


    Either you're misunderstanding something, or the compiler is
    *seriously* broken.
    As others have said, copy and paste the code post it here.
    --
    Army1987 (Replace "NOSPAM" with "email")
    No-one ever won a game by resigning. -- S. Tartakower
     
    Army1987, Aug 24, 2007
    #5
  6. Guest

    On Aug 24, 11:18 am, santosh <> wrote:
    > wrote:
    > > hi all,

    >
    > > I was trying to compile a test.c using Microsoft CL compiler with
    > > command line , I end up in errors in resolving standard types

    >
    > > unsigned char
    > > char
    > > int

    >
    > > I searched documentation, I did not able to figure out which is
    > > "Header file", which I need to include to resolve these types.

    >
    > Show us the code that failed to compile. Cut and paste, don't retype. Either
    > you're not understanding your problem, or your compiler is seriously
    > broken.


    I have gone through MS documentation, did not understood,
    please note that W4 warning level is used.


    d:/devstudio_6.0/vc98/bin/cl.exe -DMFCDebug -D_DEBUG -DDEBUG -DRWDEBUG
    -DWIN32 -D_MBCS -D_AFXDLL -D_WINDOWS -DWinNT400 -DMSVC60 -
    DAFX_NOVTABLE= -DWINVER=0x0500 -D_WIN32_WINNT=0x0500 -D_RWTOOLSDLL -
    D_
    UNICODE -DUNICODE -DO_DLL_PCLASS_ONLY -DBUILD_OcsLog -D_WINDLL -
    DCSA_HAS_DLL=1 -DACE_HAS_DLL=1 -ID:\Syngo\include\STLPort -Iw:
    \WorkSpaces\DO\include -Iw:\WorkSpaces\src\include -ID:\Syngo\include -
    I
    D:\include -ID:\syngo\versant\vds605\h -ID:\SDK\include -Id:/
    devstudio_6.0/vc98/include -Id:/devstudio_6.0/vc98/atl/include -Id:/
    devstudio_6.0/vc98/MFC/include -Iw:\WorkSpaces\src\VT\Components\Log
    \sr
    c -nologo -MDd -Od -Z7 -GR -GX -G5 -X -GF -EHa -FoOcsLog.obj -
    c -W4 w:\WorkSpaces\src\VT\Components\Log\src/OcsLog.c
    OcsLog.c
    w:\WorkSpaces\src\include\VT/Components/Log/OcsLog.h(21) : error
    C2061: syntax error : identifier 'WriteLog'
    w:\WorkSpaces\src\include\VT/Components/Log/OcsLog.h(21) : error
    C2059: syntax error : ';'
    w:\WorkSpaces\src\include\VT/Components/Log/OcsLog.h(21) : error
    C2059: syntax error : 'type'
    w:\WorkSpaces\src\VT\Components\Log\src/OcsLog.c(5) : error C2061:
    syntax error : identifier 'WriteLog'
    w:\WorkSpaces\src\VT\Components\Log\src/OcsLog.c(5) : error C2059:
    syntax error : ';'
    w:\WorkSpaces\src\VT\Components\Log\src/OcsLog.c(5) : error C2059:
    syntax error : 'type'

    omake: Shell line exit status 2. Stop.

    // the header file

    #ifndef _OcsLog_h
    #define _OcsLog_h 1


    bool WriteLog(const char* lpszApp, unsigned short wType, const char*
    lpszMessage);



    #endif

    //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    the implementation file
    bool WriteLog(const char* lpszApp, unsigned short wType, const char*
    lpszMessage)
    {
    /* I have commented the code */
    return true;
    }
     
    , Aug 24, 2007
    #6
  7. writes:
    > On Aug 24, 11:18 am, santosh <> wrote:
    >> wrote:
    >> > I was trying to compile a test.c using Microsoft CL compiler with
    >> > command line , I end up in errors in resolving standard types

    >>
    >> > unsigned char
    >> > char
    >> > int


    You see, this is why we ask people to post their exact code and error
    messages. The error message you posted later do not refer to unsigned
    char, char, or int.

    [numerous syntax error messages deleted]

    > // the header file
    >
    > #ifndef _OcsLog_h
    > #define _OcsLog_h 1
    >
    >
    > bool WriteLog(const char* lpszApp, unsigned short wType, const char*
    > lpszMessage);
    >
    >
    >
    > #endif
    >
    > //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    > the implementation file
    > bool WriteLog(const char* lpszApp, unsigned short wType, const char*
    > lpszMessage)
    > {
    > /* I have commented the code */
    > return true;
    > }


    The problem is 'bool' (and 'true').

    Unlike 'int' and 'char', 'bool' is not a predefined type in C (and
    'true' is not a predefined identifier). The compiler doesn't
    recognize the word 'bool'. For historical reasons, trying to use an
    undeclared identifer as a type name tends to result in a syntax error
    (whereas using an undeclared identifier in, say, an assignment results
    in an "undeclared identifier" message).

    <OT>In C++, 'bool' is a predefined type.</OT>

    You need to find a way to declare 'bool' and 'true' (and presumably
    'false') *or* you need to stop using them (you can use 'int' rather
    than 'bool', 0 for 'false', and 1 for 'true').

    C99 introduces 'bool', 'false', and 'true', but they're defined in
    <stdbool.h>. If your compiler supports it (not all do), you can add
    '#include <stdbool.h>' to the top of your header file. If you don't
    have <stdbool.h', you can declare 'bool' yourself. Here's how I like
    to do it:

    typedef enum { false, true } bool;

    See also section 9 of the comp.lang.c FAQ, <http://www.c-faq.com/>.

    --
    Keith Thompson (The_Other_Keith) <http://www.ghoti.net/~kst>
    San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
    "We must do something. This is something. Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"
     
    Keith Thompson, Aug 24, 2007
    #7
  8. wrote:
    > On Aug 24, 11:18 am, santosh <> wrote:
    >> wrote:
    >>> hi all,
    >>> I was trying to compile a test.c using Microsoft CL compiler with
    >>> command line , I end up in errors in resolving standard types
    >>> unsigned char
    >>> char
    >>> int


    You are wrong. The error messages are "cascading diagnostics." They
    are the result of your first error: using the unknown type 'bool', after
    which your compiler is going nuts trying to make sense of what follows.

    /* header should contain */
    #include <stdbool.h>
    bool WriteLog(const char *lpszApp, unsigned short wType,
    const char *lpszMessage);

    /* implementation should contain */
    #include <stdbool.h>
    bool WriteLog(const char *lpszApp, unsigned short wType,
    const char *lpszMessage)
    {
    return true;
    }



    > d:/devstudio_6.0/vc98/bin/cl.exe -DMFCDebug -D_DEBUG -DDEBUG -DRWDEBUG
    > -DWIN32 -D_MBCS -D_AFXDLL -D_WINDOWS -DWinNT400 -DMSVC60 -
    > DAFX_NOVTABLE= -DWINVER=0x0500 -D_WIN32_WINNT=0x0500 -D_RWTOOLSDLL -
    > D_
    > UNICODE -DUNICODE -DO_DLL_PCLASS_ONLY -DBUILD_OcsLog -D_WINDLL -
    > DCSA_HAS_DLL=1 -DACE_HAS_DLL=1 -ID:\Syngo\include\STLPort -Iw:
    > \WorkSpaces\DO\include -Iw:\WorkSpaces\src\include -ID:\Syngo\include -
    > I
    > D:\include -ID:\syngo\versant\vds605\h -ID:\SDK\include -Id:/
    > devstudio_6.0/vc98/include -Id:/devstudio_6.0/vc98/atl/include -Id:/
    > devstudio_6.0/vc98/MFC/include -Iw:\WorkSpaces\src\VT\Components\Log
    > \sr
    > c -nologo -MDd -Od -Z7 -GR -GX -G5 -X -GF -EHa -FoOcsLog.obj -
    > c -W4 w:\WorkSpaces\src\VT\Components\Log\src/OcsLog.c
    > OcsLog.c
    > w:\WorkSpaces\src\include\VT/Components/Log/OcsLog.h(21) : error
    > C2061: syntax error : identifier 'WriteLog'
    > w:\WorkSpaces\src\include\VT/Components/Log/OcsLog.h(21) : error
    > C2059: syntax error : ';'
    > w:\WorkSpaces\src\include\VT/Components/Log/OcsLog.h(21) : error
    > C2059: syntax error : 'type'
    > w:\WorkSpaces\src\VT\Components\Log\src/OcsLog.c(5) : error C2061:
    > syntax error : identifier 'WriteLog'
    > w:\WorkSpaces\src\VT\Components\Log\src/OcsLog.c(5) : error C2059:
    > syntax error : ';'
    > w:\WorkSpaces\src\VT\Components\Log\src/OcsLog.c(5) : error C2059:
    > syntax error : 'type'
    >
    > omake: Shell line exit status 2. Stop.
    >
    > // the header file
    >
    > #ifndef _OcsLog_h
    > #define _OcsLog_h 1
    >
    >
    > bool WriteLog(const char* lpszApp, unsigned short wType, const char*
    > lpszMessage);
    >
    >
    >
    > #endif
    >
    > //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    > the implementation file
    > bool WriteLog(const char* lpszApp, unsigned short wType, const char*
    > lpszMessage)
    > {
    > /* I have commented the code */
    > return true;
    > }
    >
     
    Martin Ambuhl, Aug 24, 2007
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Narayanan Sankaranarayanan

    Resolving ~ During Design-time in ASP.Net

    Narayanan Sankaranarayanan, Dec 27, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    405
    Narayanan Sankaranarayanan
    Dec 27, 2004
  2. senthil
    Replies:
    1
    Views:
    3,292
    Egbert Molenkamp
    Feb 27, 2004
  3. Chris

    "Resolving" LocalHost ??

    Chris, Aug 27, 2003, in forum: ASP .Net
    Replies:
    5
    Views:
    496
    Jason \(MFT1\)
    Aug 28, 2003
  4. Anita C

    Resolving a shortcut

    Anita C, Nov 7, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    424
    Guest
    Nov 8, 2003
  5. kmw
    Replies:
    2
    Views:
    326
Loading...

Share This Page