- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有从 opengl 示例代码中获取的代码:
#include <GL/glut.h>
// Display callback ------------------------------------------------------------
void display()
{
// clear the draw buffer .
glClear(GL_COLOR_BUFFER_BIT); // Erase everything
// set the color to use in draw
glColor3f(0.5, 0.5, 0.0);
// create a polygon ( define the vertexs)
glBegin(GL_POLYGON); {
glVertex2f(-0.5, -0.5);
glVertex2f(-0.5, 0.5);
glVertex2f( 0.5, 0.5);
glVertex2f( 0.5, -0.5);
} glEnd();
// flush the drawing to screen .
glFlush();
}
// Keyboard callback function ( called on keyboard event handling )
void keyboard(unsigned char key, int x, int y)
{
if (key == 'q' || key == 'Q')
exit(EXIT_SUCCESS);
}
// Main execution function
int main(int argc, char *argv[])
{
glutInit(&argc, argv); // Initialize GLUT
glutCreateWindow("OpenGL example"); // Create a window
glutDisplayFunc(display); // Register display callback
glutKeyboardFunc(keyboard); // Register keyboard callback
glutMainLoop(); // Enter main event loop
return (EXIT_SUCCESS);
}
应该可以吧?但是当我运行它时:
Error 1 error LNK2019: unresolved external symbol __imp__glutMainLoop@0 referenced in function _main C:\Users\Naor\documents\visual studio 2012\Projects\test\test\Source.obj test
Error 2 error LNK2019: unresolved external symbol __imp__glutKeyboardFunc@4 referenced in function _main C:\Users\Naor\documents\visual studio 2012\Projects\test\test\Source.obj test
Error 3 error LNK2019: unresolved external symbol __imp__glutDisplayFunc@4 referenced in function _main C:\Users\Naor\documents\visual studio 2012\Projects\test\test\Source.obj test
Error 4 error LNK2019: unresolved external symbol __imp____glutInitWithExit@12 referenced in function _glutInit_ATEXIT_HACK@8 C:\Users\Naor\documents\visual studio 2012\Projects\test\test\Source.obj test
Error 5 error LNK2019: unresolved external symbol __imp____glutCreateWindowWithExit@8 referenced in function _glutCreateWindow_ATEXIT_HACK@4 C:\Users\Naor\documents\visual studio 2012\Projects\test\test\Source.obj test
Error 6 error LNK1120: 5 unresolved externals C:\Users\Naor\documents\visual studio 2012\Projects\test\Debug\test.exe 1 1 test
我正确安装了 opengl、freeglut(我的意思是,它运行并且 vc++ 发现没问题),但我无法运行我找到的任何源代码..(同样的错误)
最佳答案
找到了答案,任何遇到此类问题的人请检查这些:
希望已经解决了你的错误 :)
关于c++ - 无法编译任何 opengl/freeglut/glut 源代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19401441/
我想开始使用OpenGl开发图形程序 为了开始,我正在关注 OpenGL 我遇到过使用 GLUT 和不使用 GLUT 进行编程,但作为 OpenGL 的新手,我更加困惑如何使用它? 最佳答案 GLUT
我的应用程序在使用 wglCreateContext 上下文的 Windows 上仅使用 gl/glu。 该应用程序有自己的 key 管理器,现在我喜欢为输入框和选择列表实现 GUI 框架。 我找到了
我正在用 C++ 进行一些 OpenGL 编程。 这是我的代码的一部分: #include #include #include #include #include Properties.
我正在使用 Win32 API 处理 OpenGL。因此我正在使用 wgl (Wiggle)。一切安好。除非我想使用 FREEGLUT 库中的一些形状。例如,茶壶。我正在查看 freeglut 的源代
我正在尝试在 Haskell 中制作图形,并且一直在使用 Haskell.org 的教程 (http://www.haskell.org/haskellwiki/OpenGLTutorial1)。但是
已关闭。此问题不符合Stack Overflow guidelines 。目前不接受答案。 要求提供代码的问题必须表现出对所解决问题的最低限度的了解。包括尝试的解决方案、为什么它们不起作用以及预期结果
我正在用 C 语言开发一个带有 GLUT 的应用程序。我有一个基本的 GLUT Canvas ,我可以在其中绘制 OpenGL 内容。 当其他 X11 窗口与 GLUT Canvas 重叠然后被删除时
我最近重新设计了我的应用程序,以便在 Idle 函数中完成数据收集。该程序从 argv[1] 读取文件并从该文件中解析出命令。这部分似乎都可以正常工作,并且解析的数据是准确的。 问题出在显示功能上。命
我遇到了一个奇怪的问题,当我以零延迟调用它时,glutTimerFunc 似乎随机停止工作。 这是我的代码: #include #include #include int x = 0; void
我正在处理一项作业,要求我仅使用隐藏线渲染图像。我在网上找到了有关如何删除隐藏线的内容,但我一直未能成功地弄清楚如何反转代码以使其仅绘制隐藏线。 通常,当我访问 Stack Overflow 时,我喜
我想将一个对象(立方体)乘以一定的数字,在本例中假设为 25,我确实有一个立方体的代码,并且它可以工作,但我不知道如何制作更多。我是 GLUT 的新人。 #include #include #in
嘿, 我正在尝试使用 C++ 使用 OpenGL 和 CUDA 创建场景,但是当我尝试传递函数进行初始化时收到错误消息。这是我的标题: class SimpleScene { public:
我有一个我在 6 个多月前编写的程序,它使用了 GLUT 库。 6 个月前我写的时候它运行得非常好。从那以后我就没有使用过它,也没有以任何方式编辑过代码。 该程序有一些立方体以一些随机速度四处漂浮,它
我有一个过剩的问题,我想要一个回调来知道用户何时移动我的应用程序的窗口,但我没有在过剩中发现任何东西。 我的目标是只在 Windows 上制作一个应用程序,是否可以使用 MFC 保留我的过剩代码来做到
我正在尝试在 GLUT c++ 上编写“Classic Snake”,但遇到了一些问题。 例如,当我的蛇向右移动时,我将目的地更改为向上,同时将其更改为向右蛇进入自身内部(我禁止将目的地从右更改为左)
我正在尝试使用以下摄像机代码实现摄像机控制的场景:http://www.swiftless.com/tutorials/opengl/camera2.html 还有书中的风景代码,随机生成地形。通过使
上周,我尝试了几个在阅读 GLUT 教程时发现的示例,一切都运行良好。 现在,当我重试这些相同的示例时,我得到了一个奇怪的行为:我的 GLUT 窗口显示了窗口所在位置的桌面部分(所以如果 GLUT 窗
我正在尝试使用以下方法将纹理渲染到平面: unsigned char image[HEIGHT][WIDTH][3]; ... GLuint textureId; glGenTextures(1, &
我编写了模拟选择排序操作的程序。我添加了函数 myKeyboard 来退出程序,但是由于使用函数 sleep() 来模拟动画,myKeyboard 仅在排序完成后才起作用。有什么方法可以替换函数 sl
当我编译后尝试运行这段代码时,我得到的只是一个没有内容的窗口边框,那么错误在哪里? 注意:我用的是ubuntu和gcc编译 gcc -lglut Simple.c -o Simple The out
我是一名优秀的程序员,十分优秀!