Amiga.org

Operating System Specific Discussions => Amiga OS => Amiga OS -- Development => Topic started by: Jose on September 04, 2004, 11:53:04 PM

Title: undefined reference to utilitybase or something....and about a few errors...
Post by: Jose on September 04, 2004, 11:53:04 PM
Guess I'm invading these forums :-) I'm getting an error like that about amiga.lib in the linking stage now...

There was another error left that complained about invalid types for assignment  in the following assignment for a Tagitem array's tagitem (the name for the CreateNewProc() function):
 
Code: [Select]
TagsforCrtNewPr[1].ti_Data = Buffertaskname

I have defined Buffertaskname as:
Code: [Select]
char *Buffertaskname = "MDBuffer";

I solved this with casting Buffertaskname to ULONG in the previous assignment. Is this correct?

Oh, and this:

Code: [Select]
printf("Exec Version is %d.%d\n",SysBase->LibNode.lib_Version,SysBase->LibNode.lib_Revision)

gets a warning saying that the string is suspicious :-)

Bare with me a little 8-)
Title: Re: undefined reference to utilitybase or something....and about a few errors...
Post by: Piru on September 05, 2004, 12:01:16 AM
Quote
I solved this with casting Buffertaskname to ULONG in the previous assignment. Is this correct?

Yes.

Quote
gets a warning saying that the string is suspicious

I'd say that's just vbcc being silly.
Title: Re: undefined reference to utilitybase or something....and about a few errors...
Post by: Jose on September 05, 2004, 12:44:40 AM
@Piru
Hey:-)

@all

Been trying but still getting that "undefined reference to utilitybase error".

I have opened utility.library and put the base in a variable declared as:
 
Code: [Select]
struct Library *UtilityBase; so that's not the error.
Error checking to check if the library is opened is also included...
Title: Re: undefined reference to utilitybase or something....and about a few errors...
Post by: Karlos on September 05, 2004, 09:49:06 AM
Hi Jose,

Quote

Jose wrote:

Oh, and this:

Code: [Select]
printf("Exec Version is %d.%d\n",SysBase->LibNode.lib_Version,SysBase->LibNode.lib_Revision)

gets a warning saying that the string is suspicious :-)


This warning is part of VBCC's format string checking (as the name implies). It's quite strict.

You are using %d in your string, so VBCC checks that the arguments corresponding to this are of type 'int'. If they are not, you get this warning.

Theres a lot of templates, but the most generally used ones are

%d (also %i) : int
%ld (also %li) : long int
%lu : unsigned long int
%h : short int
%hu : unsigned short int
%c : char
%s : char* (C string)
%f : double
%x : hex, lower case - unsigned int
%X : hex, upper case - unsigned int

VBCC compares all the above (and more) with your arguments. The values you are passing are not explicitly "int", therefor it flags a warning that %d is suspicious.
Title: Re: undefined reference to utilitybase or something....and about a few errors...
Post by: Thomas on September 05, 2004, 09:43:57 PM

Yes, but the makers of VBCC didn't consider some cases where the types have to be different.

E.g. compilers on the Amiga (and VBCC is no exeption) always put longwords on the stack.

So the following example will not work:

void main (void)
{
short a = 5;
printf ("a = %h\n",a)
}

Instead it must be %d or %ld which is warned as "suspicius" by VBCC.

Bye,
Thomas