Welcome, Guest. Please login or register.

Author Topic: Is this "Invalid types for assignment" freaking out?  (Read 2187 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show all replies
Re: Is this "Invalid types for assignment" freaking out?
« on: September 04, 2004, 07:30:34 PM »
@Jose

If you don't #include any headers for OS libraries, the compiler has no idea what a 'struct Library' is. Furthermore, it has no clue what OpenLibrary() returns and (in infuriating C legacy madness) assumes int.

It then manages to see that the "pointer to some unknown 'struct Library'" is not compatible with type 'int'.

You should include and also any headers specific to any libraries you want to use.

The same problem is likely the cause of your TagItem woes. If you do not include the (or whatever it is), the compiler cannot know what "struct TagItem" looks like and so you cannot access any of its members.
int p; // A
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show all replies
Re: Is this "Invalid types for assignment" freaking out?
« Reply #1 on: September 04, 2004, 07:31:25 PM »
As always, the ever vigilant Piru beat me to it :-D
int p; // A
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show all replies
Re: Is this "Invalid types for assignment" freaking out?
« Reply #2 on: September 04, 2004, 07:45:48 PM »
@Jose

C is a very minimalist language. Without including any headers, the only types available are the elemental ones (char, int, short, long and their signed/unsigned qualified versions, float, double and all their pointers). The only functions and structures available (without including any headers again) are the ones you write in your .c file :-)

It is partially due to this minimalist simplicity that C is equally loved and hated :-)
int p; // A
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show all replies
Re: Is this "Invalid types for assignment" freaking out?
« Reply #3 on: September 05, 2004, 12:19:17 AM »
Quote

Piru wrote:
@Karlos

I'm always fast after sauna. :-)


Ineed. But surely all that moisture must play havoc with your computer :-D
int p; // A