Welcome, Guest. Please login or register.

Author Topic: undefined reference to utilitybase or something....and about a few errors...  (Read 951 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline JoseTopic starter

  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 2869
    • Show only replies by Jose
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-)
\\"We made Amiga, they {bleep}ed it up\\"
 

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show only replies by Piru
    • http://www.iki.fi/sintonen/
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.
 

Offline JoseTopic starter

  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 2869
    • Show only replies by Jose
@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...
\\"We made Amiga, they {bleep}ed it up\\"
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16867
  • Country: gb
  • Thanked: 4 times
    • Show only replies by Karlos
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.
int p; // A
 

Offline Thomas


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