Re: Compile warning when setting entry text



On 28 Aug, John Cupitt wrote:
> gtk uk2 net wrote:
>> In my application, on a form, the first entry has to be calculated (next
>> available transaction number), but it has to be an entry because it can
>> eventually be modified by the user, defaulting to the calculated value.
>> 
>> Setting the default with
>> 
>> gtk_entry_set_text(GTK_ENTRY(entry), nextavailnumber() );
>> 
>> gives me the following warning at compile time:
>> 
>> passing arg 2 of `gtk_entry_set_text' makes pointer from integer without
>> a cast.
>> 
>> I have extern *nextavailnumber() defined returning a character from a
>> database.
>> 
>> I tried returning pointers instead of characters from the external
>> functions, the message is different, but there is still a warning.
> 
> Hi Henry, sounds like you need:
> 
> 	extern const char *nextavailablenumber();
> 
> Otherwise it'll default to int, and cause the warning you're seeing.
> 
> John
> 

It doesn't change a thing. It does not default to an int. Let me
describe another form where the same problem arises:

I enter, in a gtk entry, the employee ID number; when I hit return, in
the other entries appear all the data of that employee, i.e. name, last
name, hiring date, salary etc... and I can modify all these entries.
They all have to be entries since it is the way I chose to update the
database. 

For each entry I calculate the default value, which is always a string,
and for each one I get a compile warning, but it works fine.... Just
debugging new features in the middle of several hundred warnings is a
real pain!

Henry







[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]