簡體   English   中英

警告:賦值使指針從整數開始而未強制轉換

[英]Warning: assignment makes pointer from integer without a cast undefined

我意識到有很多與此問題相關的問題,但我無法從所讀的內容中吸取教訓。

我正在嘗試開始為Amiga學習C,並決定嘗試按照本教程進行操作: http : //www.pcguru.plus.com/tutorial/amiga_c.html

在達到這一點時,我已經遇到了菜鳥問題:

#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;
}

我正在通過Shell中的以下命令使用GCC編譯器:

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進行編程的首次嘗試,所以我想我缺少明顯的東西。

您可能需要包括一個或多個這些其他文件,以獲取缺少的功能的原型:

#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所建議的,如果您的編譯器默認不包含必需的庫,並且您未指定它,則可能會遇到鏈接錯誤。

如果您提到要在AmigaOS 4.x下編譯程序,答案將是顯而易見的。 OS4中的庫函數調用必須也包含庫接口-IIntuition-> LockPubScreen(),IDOS-> Delay()等-或必須在代碼開頭#define __USE_INLINE__

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM