Compile error message

D

David Smith

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:249: cannot convert `short unsigned int*' to
`SLsmg_Char_Type*'
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_dchs));

unsigned short linebuf[sizeof(slang_dchs)];

extern unsigned int SLsmg_read_raw (SLsmg_Char_Type *, 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
 
M

Mac

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:249: cannot convert `short unsigned int*' to
`SLsmg_Char_Type*'
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_dchs));

unsigned short linebuf[sizeof(slang_dchs)];

extern unsigned int SLsmg_read_raw (SLsmg_Char_Type *, 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

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
 
J

Jack Klein

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:249: cannot convert `short unsigned int*' to
`SLsmg_Char_Type*'
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_dchs));

unsigned short linebuf[sizeof(slang_dchs)];

extern unsigned int SLsmg_read_raw (SLsmg_Char_Type *, 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

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_Type' 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. Indiscriminately mixing signed
and unsigned types can cause hard-to-find program defects.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top