【问题标题】:Eclipse gives an error 'Function 'MessageBoxA' could not be resolved' but still compiles successfully?Eclipse 给出了一个错误'函数'MessageBoxA'无法解析'但仍然编译成功?
【发布时间】:2011-08-26 08:36:01
【问题描述】:

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

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

但 MessageBox 带有红色下划线,错误为:'Function 'MessageBoxA' could not be resolved'。 SendMessage() 显示相同的错误。该程序运行正常,但我无法弄清楚为什么有红线。 :@

【问题讨论】:

    标签: c++ eclipse winapi user-interface mingw


    【解决方案1】:

    Eclipse 无法解析 WinAPI 函数。您需要将带有 WinAPI 标头 (windows.h) 的文件夹添加到 Include paths

    【讨论】:

    • 它只是让我添加文件夹,而不是文件。我应该将它添加到索引器中吗?
    • 是的,添加所有带有 WinAPI 标头的文件夹并刷新整个项目。这足以解析MessageBoxSendMessage 和其他WinAPI 函数。
    猜你喜欢
    • 2013-05-23
    • 1970-01-01
    • 2022-01-25
    • 2019-04-19
    • 2011-03-24
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多