Warning: assignment makes pointer from integer without cast undefined

I understand that there are many questions related to this problem, but I could not make a chapter and a story from those that I read.

I am trying to start learning C for Amiga and decided to try this tutorial: http://www.pcguru.plus.com/tutorial/amiga_c.html

Upon reaching this point, I already run into noob problems:

#include <proto/intuition.h> #include <intuition/screens.h> #include <proto/dos.h> #include <stdio.h> int main(void) { struct Screen *myScreen; if (myScreen = LockPubScreen(NULL)) { printf("Public Screen locked.\n"); Delay(100); UnlockPubScreen(NULL, myScreen); printf("Public Screen unlocked.\n"); } return 0; } 

I use the GCC compiler with the following command from the shell:

 gcc -o LockPubScreen LockPubScreen.c 

This returns the following:

 Warning: assignment makes pointer from integer without a cast undefined reference to 'LockPubScreen' undefined reference to 'Delay' undefined reference to 'UnlockPubScreen 

Apart from "HelloWorld", this is the first attempt at either C or Amiga programming, so I assume that I will miss something obvious.

+2
source share
2 answers

You probably need to include one or more of these additional files to get a prototype for functions that you are missing:

 #include <intuition/gadgetclass.h> #include <intuition/IntuitionBase.h> #include <libraries/gadtools.h> #include <clib/exec_protos.h> #include <clib/intuition_protos.h> #include <clib/gadtools_protos.h> 

Then, as NPE suggests, there may be a problem with link errors if your compiler does not include a props library by default, and if you do not specify one.

+3
source

If you mentioned that you tried to compile the program for AmigaOS 4.x, the answer would be obvious. The library function call in OS4 should also contain the library interface - IIntuition-> LockPubScreen (), IDOS-> Delay (), etc. - or you must #define __USE_INLINE__ at the beginning of the code.

+3
source

Source: https://habr.com/ru/post/1490071/


All Articles