链接器问题与mingw,notepad ++和freeglut [英] Linker issue with mingw, notepad++ and freeglut

查看:169
本文介绍了链接器问题与mingw,notepad ++和freeglut的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一名在C ++中使用OpenGL的学生。我正在尝试让freeGLUT与MinGW合作。我问,因为我已经尝试了很多次网站,并且没有明确的解决方案,至少据我所知。几个月来我一直有这个问题。



虽然使用Visual Studio是最简单的使用环境,但我更喜欢使用自己的自定义环境。 />


我遇到的问题是链接器。作为一个新用户,我很难理解如何使用链接器。



我的主要目标是编译任何基本程序,例如,这个测试一个:

I'm a student working with OpenGL in C++. I'm trying to get freeGLUT to work with MinGW. I'm asking because I've already tried a ton of sites, multiple times and there is no clear solution, at least to my knowledge. I've had this problem for months.

Although using Visual Studio would be the simplest environment to use, I'd prefer to use my own customized environment.

The issue I'm having is the linker. I'm having great difficulty understanding as a newer user how to use the linker.

My main goal is simply to compile any basic program, for example, this test one:

#include <GL/glut.h>

    void displayMe(void)
    {
        glClear(GL_COLOR_BUFFER_BIT);
        glBegin(GL_POLYGON);
            glVertex3f(0.0, 0.0, 0.0);
            glVertex3f(0.5, 0.0, 0.0);
            glVertex3f(0.5, 0.5, 0.0);
            glVertex3f(0.0, 0.5, 0.0);
        glEnd();
        glFlush();
    }

    int main(int argc, char** argv)
    {
        glutInit(&argc, argv);
        glutInitDisplayMode(GLUT_SINGLE);
        glutInitWindowSize(300, 300);
        glutInitWindowPosition(100, 100);
        glutCreateWindow("Hello world :D");
        glutDisplayFunc(displayMe);
        glutMainLoop();
        re

turn 0;
}

以下是我的链接器错误:

Here are my linker errors:

> C:\Users\Exhuman\AppData\Local\Temp\ccM8iHrk.o:main.cpp:(.text+0x25):
> undefined reference to `__imp___glutInitWithExit'
> C:\Users\Exhuman\AppData\Local\Temp\ccM8iHrk.o:main.cpp:(.text+0x4c):
> undefined reference to `__imp___glutCreateWindowWithExit'
> C:\Users\Exhuman\AppData\Local\Temp\ccM8iHrk.o:main.cpp:(.text+0x72):
> undefined reference to `__imp___glutCreateMenuWithExit'
> C:\Users\Exhuman\AppData\Local\Temp\ccM8iHrk.o:main.cpp:(.text+0x8e):
> undefined reference to `__imp_glClear'
> C:\Users\Exhuman\AppData\Local\Temp\ccM8iHrk.o:main.cpp:(.text+0x9c):
> undefined reference to `__imp_glBegin'
> C:\Users\Exhuman\AppData\Local\Temp\ccM8iHrk.o:main.cpp:(.text+0xb1):
> undefined reference to `__imp_glVertex3f'
> C:\Users\Exhuman\AppData\Local\Temp\ccM8iHrk.o:main.cpp:(.text+0xca):
> undefined reference to `__imp_glVertex3f'
> C:\Users\Exhuman\AppData\Local\Temp\ccM8iHrk.o:main.cpp:(.text+0xe7):
> undefined reference to `__imp_glVertex3f'
> C:\Users\Exhuman\AppData\Local\Temp\ccM8iHrk.o:main.cpp:(.text+0x100):
> undefined reference to `__imp_glVertex3f'
> C:\Users\Exhuman\AppData\Local\Temp\ccM8iHrk.o:main.cpp:(.text+0x109):
> undefined reference to `__imp_glEnd'
> C:\Users\Exhuman\AppData\Local\Temp\ccM8iHrk.o:main.cpp:(.text+0x112):
> undefined reference to `__imp_glFlush'
> C:\Users\Exhuman\AppData\Local\Temp\ccM8iHrk.o:main.cpp:(.text+0x14b):
> undefined reference to `__imp_glutInitDisplayMode'
> C:\Users\Exhuman\AppData\Local\Temp\ccM8iHrk.o:main.cpp:(.text+0x15e):
> undefined reference to `__imp_glutInitWindowSize'
> C:\Users\Exhuman\AppData\Local\Temp\ccM8iHrk.o:main.cpp:(.text+0x171):
> undefined reference to `__imp_glutInitWindowPosition'
> C:\Users\Exhuman\AppData\Local\Temp\ccM8iHrk.o:main.cpp:(.text+0x18d):
> undefined reference to `__imp_glutDisplayFunc'
> C:\Users\Exhuman\AppData\Local\Temp\ccM8iHrk.o:main.cpp:(.text+0x196):
> undefined reference to `__imp_glutMainLoop' collect2.exe: error: ld
> returned 1 exit status





我包含一个下载链接到我的自定义工作环境,因为我觉得设置太费时,组件是MinGW,如果没有错误,Notepad ++和NppExec程序可以用f9编译,同样可以在编译后用ctrl f9运行。我通常使用主目录中的.bat来运行程序。



http://www.filedropper.com/env_1



如果有人能帮我解决这个问题,我会非常感激。



我尝试过的方法:



本网站:http://www.transmissionzero.co.uk/computing/using-glut-with-mingw/是我找到的最接近的网站,我试图联系作者寻求解决方案,到目前为止他一直没有反应。



我也试图查找MinGW和链接器,但行话是我的理解。



I'm including a download link to my custom working environment as I feel it would be too time consuming to set up, the components are MinGW, Notepad++ and NppExec programs can be compiled with "f9" if there are no errors, and similarly can be run with "ctrl f9" once compiled. I usually run the program using the .bat in the main directory.

http://www.filedropper.com/env_1

If anyone could help me out with this issue, I'd greatly appreciate it.

What I have tried:

This site: http://www.transmissionzero.co.uk/computing/using-glut-with-mingw/ was the closest I found, and I tried to contact the author for a solution and so far he has been unresponsive.

I also tried to look up MinGW and the linker, but the jargon is outwith my comprehension.

推荐答案

我不是C ++ dev,但找到了 StackOverflow Q& A [ ^ 应该指向正确的方向。
I'm not a C++ dev, but found a StackOverflow Q&A[^] that should point you in the right direction.


这篇关于链接器问题与mingw,notepad ++和freeglut的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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