http://dev.yesky.com/318/2399818.shtml
按照上面的教程,我建了控制台程序,但是编译可以通过,组建通不过,提示错误:
2.obj : error LNK2001: unresolved external symbol _auxSetOneColor@16
2.obj : error LNK2001: unresolved external symbol _auxMainLoop@4
2.obj : error LNK2001: unresolved external symbol _auxReshapeFunc@4
2.obj : error LNK2001: unresolved external symbol _auxInitWindowA@4
2.obj : error LNK2001: unresolved external symbol _auxInitPosition@16
2.obj : error LNK2001: unresolved external symbol _auxInitDisplayMode@4
请问这到底是哪里出问题了?#include "stdafx.h"
#include <stdlib.h>
#include <GL/glut.h>  
#include <GL/gl.h>
#include <GL/glaux.h>
#include "windows.h"void init(void)
{
glClearColor(1.0,1.0,1.0,1.0);
glClear(GL_COLOR_BUFFER_BIT);
glShadeModel(GL_SMOOTH);
}void palette(void)
{
GLint i;
static GLfloat rgb[8][3]={{1,0,0},{1,0,0.5},{1,0,1},
{0,0,1},{0,1,1},{0,1,0},{1,1,0},{1,0.5,0}};for(i = 0;i<8;i++)
{
auxSetOneColor(i+1,rgb[i][0],rgb[i][1],rgb[i][2]);//设置颜色
}
}void DrawColorFans(void)
{
GLint j;glTranslatef(-15,-15,0);
for(j = 0;j<8;j++)
{
glIndexd(j+1);//设置当前颜色索引
/*在不同位置绘制球体*/
glTranslatef(j,j-1,0);
glutSolidSphere(1,20,20);}
}void CALLBACK display(void)
{
palette();
DrawColorFans();
glFlush();
}void CALLBACK reshape(GLsizei w,GLsizei h)
{
glViewport(0,0,w,h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(100,1,1,20);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0,0,-15);
}
void main()
{
auxInitDisplayMode(AUX_SINGLE|AUX_INDEX);
auxInitPosition(100,100,500,500);
auxInitWindow("draw the color sphere");
init();
auxReshapeFunc(reshape);
auxMainLoop(display);
}

解决方案 »

  1.   

    #include <GL/glaux.h> 
    这不是写了么?
      

  2.   

    请问你是怎么解决的 我也遇到了这样的问题!
    将UNICODE字符集改成多文本字符集后出现了你所出现的问题。
      

  3.   

    我的错误也是
    bj : error LNK2005: "void __cdecl init(void)" (?init@@YAXXZ) already defined in 2406070412.obj
    ci.obj : error LNK2005: _main already defined in 2406070412.obj
    ci.obj : error LNK2001: unresolved external symbol _auxSetOneColor@16
    ci.obj : error LNK2001: unresolved external symbol _auxMainLoop@4
    ci.obj : error LNK2001: unresolved external symbol _auxReshapeFunc@4
    ci.obj : error LNK2001: unresolved external symbol _auxInitWindowA@4
    ci.obj : error LNK2001: unresolved external symbol _auxInitPosition@16
    ci.obj : error LNK2001: unresolved external symbol _auxInitDisplayMode@4实在无法解决求高手帮助