警告:赋值时将整数指针,未不确定铸造 [英] Warning: assignment makes pointer from integer without a cast undefined

查看:220
本文介绍了警告:赋值时将整数指针,未不确定铸造的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道有很多有关这一问题的问题,但我无法从我读通过那些使头部也没有故事。

I realise there are a lot of questions related to this issue but I couldn't make head nor tale from the ones I read through.

我想开始学习C为Amiga,决定试试下面这个教程:
http://www.pcguru.plus.com/tutorial/amiga_c.html

I'm trying to start learning C for the Amiga and decided to have a try following this tutorial: http://www.pcguru.plus.com/tutorial/amiga_c.html

在达到这一点,我已经运行到小白的问题:

On reaching this point, I'm already running 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;
}

我使用的GCC编译器从程序运行以下命令:

I'm using the GCC compiler with the following command from the Shell:

gcc -o LockPubScreen LockPubScreen.c

这将返回以下内容:

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

除了'的HelloWorld'这是不是C中的第一次尝试,或编程的Amiga所以我想我失去了一些东西明显。

Apart from 'HelloWorld' this is the first attempt at either C or programming the Amiga so I imagine I missing something obvious.

推荐答案

您可能需要包括这些附加文件的一个或多个,以获得原型你缺少的功能:

You probably need to include one or more of these additional files to get the prototype for the functions you're 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>

然后,NPE暗示,可能会遇到链接错误,如果你的编译器不包括在默认情况下必要的库,如果你不指定它。

Then, as NPE suggests, may may run into link errors if your compiler doesn't include the requisite library by default, and if you don't specify it.

这篇关于警告:赋值时将整数指针,未不确定铸造的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆