Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用mingw交叉编译windows的opengl应用程序_Opengl_Mingw_Cross Compiling - Fatal编程技术网

使用mingw交叉编译windows的opengl应用程序

使用mingw交叉编译windows的opengl应用程序,opengl,mingw,cross-compiling,Opengl,Mingw,Cross Compiling,呵呵,我在运行linux(ubuntu) 我在这方面遇到了一些麻烦。我尝试下载glut32.dll并将其粘贴到mingw的lib/目录中,同时在include/中设置适当的头文件,但是-尽管编译过程很好-链接器在查找符号时遇到了严重问题 我该怎么做呢?如何使用mingw为windows构建opengl应用程序 谢谢,在Windows世界中,要将某些内容链接到DLL,您需要一个“导入库”。您可以将其视为带有存根函数的静态lib,存根函数公开DLL的符号。你需要寻找liblut32.a 如果你找不到

呵呵,我在运行linux(ubuntu)

我在这方面遇到了一些麻烦。我尝试下载glut32.dll并将其粘贴到mingw的lib/目录中,同时在include/中设置适当的头文件,但是-尽管编译过程很好-链接器在查找符号时遇到了严重问题

我该怎么做呢?如何使用mingw为windows构建opengl应用程序


谢谢,

在Windows世界中,要将某些内容链接到DLL,您需要一个“导入库”。您可以将其视为带有存根函数的静态lib,存根函数公开DLL的符号。你需要寻找liblut32.a


如果你找不到,甚至可能有一个Visual C++来在网络上的某个地方导入导入库转换工具…(我已经有一段时间不需要这样的东西了,所以也许我只是梦见了那部分。)

实际上,你甚至不需要GLUT,它已经存在了,只需要链接到libopengl32.a,它将可执行文件链接到系统上的本机opengl32.dll

typedef struct RENDER_SURFACE {
    void (*redraw)(struct RENDER_SURFACE*);
    HWND hWnd;
    HINSTANCE hInstance;
    HDC hdc;
    HGLRC hrc;
    int width;
    int height;
    int pix_fmt;
    float light_position[4];
    float light_ambient[4];
    float light_diffuse[4];
    float light_specular[4];
    float light_shininess;
} RENDER_SURFACE;

static LRESULT AppProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    RENDER_SURFACE* rs = (RENDER_SURFACE*)GetWindowLongPtr(hWnd, GWLP_USERDATA);
    if (uMsg == WM_CREATE)
    {
        RECT rc;
        PIXELFORMATDESCRIPTOR pfd;
        rs = (RENDER_SURFACE*)((LPCREATESTRUCT)lParam)->lpCreateParams;
        SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)rs);
        rs->hWnd = hWnd;
        rs->hdc = GetDC(hWnd);
        GetClientRect(hWnd, &rc);
        rs->width = rc.right-rc.left;
        rs->height = rc.bottom-rc.top;
        memset(&pfd, 0, sizeof(pfd));
        pfd.nSize = sizeof(pfd);
        pfd.nVersion = 1;
        pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_DOUBLEBUFFER | PFD_SUPPORT_OPENGL;
        pfd.cColorBits = 24;
        pfd.cDepthBits = 32;
        rs->pix_fmt = ChoosePixelFormat(rs->hdc, &pfd); 
        if (!rs->pix_fmt)
        {
            MessageBox(hWnd, "ChoosePixelFormat FAILED!", "Fatal Error", MB_OK | MB_ICONSTOP);
            DestroyWindow(hWnd);
            return -1;
        }
        SetPixelFormat(rs->hdc, rs->pix_fmt, &pfd);
        rs->hrc = wglCreateContext(rs->hdc);
        wglMakeCurrent(rs->hdc, rs->hrc);
        /* SwapBuffers(rs->hdc); */
        return 0;
    }
    else if (uMsg == WM_PAINT)
    {
        /* other stuffs */
    }
    return DefWindowProc(hWnd, uMsg, wParam, lParam);
}

几个月前,在我的图形课上,我也尝试过这样做。我尝试了所有我能想到的事情,但始终无法解决链接器问题。最后我用微软的编译器编译了它,它运行得很好。