Compile error message

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • David Smith

    #1

    Compile error message

    I am having a problem. I am attempting to compile the fte text editor
    (fte-20020324-common.zip and fte-20020324-src.zip on Redhat linux 8.0.
    Among
    the error messages I get is the following:
    ---------------------------------------------------------------
    con_slang.cpp: In function `int ConInit(int, int)':
    con_slang.cpp:2 49: cannot convert `short unsigned int*' to
    `SLsmg_Char_Typ e*'
    for argument `1' to `unsigned int SLsmg_read_raw( SLsmg_Char_Type *,
    unsigned
    int)'
    ---------------------------------------------------------------

    The various definitions and usages:

    SLsmg_read_raw( linebuf, sizeof(slang_dc hs));

    unsigned short linebuf[sizeof(slang_dc hs)];

    extern unsigned int SLsmg_read_raw (SLsmg_Char_Typ e *, unsigned int);

    typedef unsigned short SLsmg_Char_Type ;

    I cannot for the life of me figure out the error message. Could someone
    please
    point me in some directions? There are some other messages of the same
    type,
    but if I can get some help on the above, it might enable me to resolve the
    others. Thank you
  • Mac

    #2
    Re: Compile error message

    On Fri, 29 Oct 2004 16:55:34 -0700, David Smith wrote:
    [color=blue]
    > I am having a problem. I am attempting to compile the fte text editor
    > (fte-20020324-common.zip and fte-20020324-src.zip on Redhat linux 8.0.
    > Among
    > the error messages I get is the following:
    > ---------------------------------------------------------------
    > con_slang.cpp: In function `int ConInit(int, int)':
    > con_slang.cpp:2 49: cannot convert `short unsigned int*' to
    > `SLsmg_Char_Typ e*'
    > for argument `1' to `unsigned int SLsmg_read_raw( SLsmg_Char_Type *,
    > unsigned
    > int)'
    > ---------------------------------------------------------------
    >
    > The various definitions and usages:
    >
    > SLsmg_read_raw( linebuf, sizeof(slang_dc hs));
    >
    > unsigned short linebuf[sizeof(slang_dc hs)];
    >
    > extern unsigned int SLsmg_read_raw (SLsmg_Char_Typ e *, unsigned int);
    >
    > typedef unsigned short SLsmg_Char_Type ;
    >
    > I cannot for the life of me figure out the error message. Could someone
    > please
    > point me in some directions? There are some other messages of the same
    > type,
    > but if I can get some help on the above, it might enable me to resolve the
    > others. Thank you[/color]

    It appears that your files are .cpp files. Are they c or c++? The two
    languages are different, you know. If the files are c++, they are off
    topic in comp.lang.c.

    Anyway, the error message is fairly straightforward , without even looking
    at your definitions and so on.

    The first argument to SLsmg_read_raw( ) is expected by the compiler to be
    of type "pointer to SLsmg_Char_Type ".

    The ACTUAL type you are trying to pass into the function, on line 249, is
    "pointer to unsigned short."

    This actually matches your definitions and usage. While the type mismatch
    doesn't seem right, I wouldn't think it would necessarily stop the
    compiler from producing an executable if it is operating as a c compiler.
    But maybe it is operating as a c++ compiler?

    Ultimately, this is a build problem that you will have to solve by talking
    to the people who maintain the code, or people who are knowledgeable about
    your platform (Redhat, I guess).

    Don't give up, I'm sure you can straighten it out if you persist.

    --Mac

    Comment

    • Jack Klein

      #3
      Re: Compile error message

      On Fri, 29 Oct 2004 16:55:34 -0700, David Smith <ac063@lafn.org > wrote
      in comp.lang.c:
      [color=blue]
      > I am having a problem. I am attempting to compile the fte text editor
      > (fte-20020324-common.zip and fte-20020324-src.zip on Redhat linux 8.0.
      > Among
      > the error messages I get is the following:
      > ---------------------------------------------------------------
      > con_slang.cpp: In function `int ConInit(int, int)':
      > con_slang.cpp:2 49: cannot convert `short unsigned int*' to
      > `SLsmg_Char_Typ e*'
      > for argument `1' to `unsigned int SLsmg_read_raw( SLsmg_Char_Type *,
      > unsigned
      > int)'
      > ---------------------------------------------------------------
      >
      > The various definitions and usages:
      >
      > SLsmg_read_raw( linebuf, sizeof(slang_dc hs));
      >
      > unsigned short linebuf[sizeof(slang_dc hs)];
      >
      > extern unsigned int SLsmg_read_raw (SLsmg_Char_Typ e *, unsigned int);
      >
      > typedef unsigned short SLsmg_Char_Type ;
      >
      > I cannot for the life of me figure out the error message. Could someone
      > please
      > point me in some directions? There are some other messages of the same
      > type,
      > but if I can get some help on the above, it might enable me to resolve the
      > others. Thank you[/color]

      The compiler states that the first argument to the function
      SLmsg_read_raw( ) is supposed to be a pointer to a signed short int in
      the error message, and I'll have to assume it is correct because you
      didn't show us the prototype for the function.

      You do show a typedef of 'SLmsg_Char_Typ e' as an alias for unsigned
      short int, although using 'Char' in the name of something that isn't a
      character type is likely to be considered extremely bad by most C
      programmers.

      In any case, your function needs a pointer to signed short, and you
      are passing is a value of pointer to unsigned short. These are
      incompatible types, and the conversion requires a cast. Or changing
      either the parameter or typedef type. Indiscriminatel y mixing signed
      and unsigned types can cause hard-to-find program defects.

      --
      Jack Klein
      Home: http://JK-Technology.Com
      FAQs for
      comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
      comp.lang.c++ http://www.parashift.com/c++-faq-lite/
      alt.comp.lang.l earn.c-c++

      Comment

      Working...