Eclipse给出错误'Function'MessageBoxA'无法解析“,但是仍然可以成功编译? [英] Eclipse gives an error 'Function 'MessageBoxA' could not be resolved' but still compiles successfully?

查看:220
本文介绍了Eclipse给出错误'Function'MessageBoxA'无法解析“,但是仍然可以成功编译?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

eclipse在使用MinGW工具链(和Internal Builder)在eclipse上编译Win32应用程序时,会编译以下代码:

 包括< windows.h> 
int WinMain(HINSTANCE p1,HINSTANCE p2,LPSTR p3,int p4)
{
MessageBox(0,Hello,MyProg,MB_OK);
return 0;
}

但是MessageBox用红色加下划线,错误:'Function'MessageBoxA'无法解决。 SendMessage()显示相同的错误。该程序工作正常,但我无法弄清楚为什么红线在那里。 :@

解决方案

Eclipse无法解析WinAPI功能。您需要添加具有WinAPI头文件夹( windows.h )到包含路径


While compile Win32 applications on eclipse using the MinGW toolchain (and Internal Builder), eclipse compiles the following code:

#include <windows.h>
int WinMain (HINSTANCE p1, HINSTANCE p2, LPSTR p3, int p4)
{
    MessageBox(0, "Hello.", "MyProg", MB_OK);
    return 0;
}

But MessageBox is underlined in red, with the error: 'Function 'MessageBoxA' could not be resolved'. The same error is shown for SendMessage(). The program works OK, but I cant figure out why the red line is there. :@

解决方案

Eclipse can't resolve WinAPI functions. You need to add folders with WinAPI headers (windows.h) in to Include paths.

这篇关于Eclipse给出错误'Function'MessageBoxA'无法解析“,但是仍然可以成功编译?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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