VC6 오류 LNK2001: unresolved external 문제
#include <windows.h>
#include <GL/glew.h>
#include <GL/glut.h>
#define BUFFER_OFFSET(offset) ((GLvoid *) NULL + offset)
#define XStart -0.8
#define XEnd 0.8
#define YStart -0.8
#define YEnd 0.8
#define NumXPoints 11
#define NumYPoints 11
#define NumPoints (NumXPoints*NumYPoints)
#define NumPointsPerStrip (2*NumXPoints)
#define NumStrips (NumYPoints-1)
#define RestartIndex 0xffff
GLfloat color[6][3]={
{1.0,1.0,1.0},{1.0,0.0,0.0},{1.0,1.0,0.0},
{0.0,1.0,0.0},{0.0,1.0,1.0},{0.0,0.0,1.0}
};
int colorIndex =0;
void setVertex()
{
int i,j,n;
GLfloat * vertices;
GLfloat x,y,dx,dy,*tmp;
//glBindBuffer(GL_ARRAY_BUFFER,0);
vertices = (GLfloat *)glMapBuffer(GL_ARRAY_BUFFER,GL_WRITE_ONLY);
if(vertices==NULL){
exit(EXIT_FAILURE);
}
else{
dx = (XEnd-XStart)/(NumXPoints-1);
dy = (YEnd-YStart)/(NumYPoints-1);
tmp = vertices;
n=0;
for(j=0;j<NumYPoints;++j)
{
y=YStart + j*dy;
for (i=0;i<NumXPoints;i++)
{
x = XStart+i*dx;
*tmp++ = color[(colorIndex+i+j)%6][0];
*tmp++ = color[(colorIndex+i+j)%6][1];
*tmp++ = color[(colorIndex+i+j)%6][2];
*tmp++ = x;
*tmp++ = y;
*tmp++ = 0.0;
}
}
glUnmapBuffer(GL_ARRAY_BUFFER);
//glVertexPointer(2,GL_FLOAT,0,BUFFER_OFFSET(0));
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
glInterleavedArrays(GL_C3F_V3F, 0, 0);
}
}
void setIndices()
{
int i,j;
GLushort * indices;
GLushort *index,bottomRow,topRow;
//glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,0);
indices = (unsigned short *)glMapBuffer(GL_ELEMENT_ARRAY_BUFFER,GL_WRITE_ONLY);
if(indices==NULL)
{
exit(EXIT_FAILURE);
}
else{
index = indices;
for(j=0;j<NumStrips;j++){
bottomRow = j*NumYPoints;
topRow= bottomRow+NumYPoints;
for(i=0;i<NumXPoints;i++){
*index++=topRow+i;
*index++=bottomRow+i;
}
*index++=RestartIndex;
}
glUnmapBuffer(GL_ELEMENT_ARRAY_BUFFER);
}
}
void init()
{
GLuint vbo,ebo;
glGenBuffers(1,&vbo);
glBindBuffer(GL_ARRAY_BUFFER,vbo);
glBufferData(GL_ARRAY_BUFFER,6*NumPoints*sizeof(GLfloat),NULL,GL_STATIC_DRAW);
// setVertex();
glGenBuffers(1,&ebo);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,ebo);
glBufferData(GL_ELEMENT_ARRAY_BUFFER,NumStrips*(NumPointsPerStrip+1)*sizeof(GLushort),NULL,GL_STATIC_DRAW);
// setIndices();
glPrimitiveRestartIndex(RestartIndex);
glEnable(GL_PRIMITIVE_RESTART);
}
void display()
{
setVertex();
setIndices();
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glColor3f(1,1,1);
glDrawElements(GL_TRIANGLE_STRIP,NumStrips*(NumPointsPerStrip+1),GL_UNSIGNED_SHORT,0);
glutSwapBuffers();
}
void mouse(int button,int state,int x,int y)
{
switch(button){
case GLUT_LEFT_BUTTON:
if(state==GLUT_DOWN)
{
colorIndex++;
if(colorIndex==6)
colorIndex = 0;
glutPostRedisplay();
}
break;
case 27:
{
exit(0);
break;
}
default:
break;
}
}
int main(int argc, char ** argv)
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGB);
glutInitWindowSize(250,250);
glutInitWindowPosition(100,100);
glutCreateWindow(argv[0]);
glewInit();
init();
glutDisplayFunc(display);
glutMouseFunc(mouse);
glutMainLoop();
return 0;
}
컴파일하면 다음과 같은 오류가 발생합니다.
-------------------Configuration: primrestart - Win32 Debug--------------------
Linking...
primrestart.obj : error LNK2001: unresolved external symbol __imp____glewUnmapBuffer
primrestart.obj : error LNK2001: unresolved external symbol __imp____glewMapBuffer
primrestart.obj : error LNK2001: unresolved external symbol __imp____glewPrimitiveRestartIndex
primrestart.obj : error LNK2001: unresolved external symbol __imp____glewBufferData
primrestart.obj : error LNK2001: unresolved external symbol __imp____glewBindBuffer
primrestart.obj : error LNK2001: unresolved external symbol __imp____glewGenBuffers
primrestart.obj : error LNK2001: unresolved external symbol __imp__glewInit
Debug/primrestart.exe : fatal error LNK1120: 7 unresolved externals
Error executing link.exe.
primrestart.exe - 8 error(s), 0 warning(s)
소인 좀 가르쳐 주세요.제가 VC2008로 바꾼 것도 마찬가지입니다. 고수님께 감사드립니다.
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
다양한 언어의 JSONJSON은 Javascript 표기법을 사용하여 데이터 구조를 레이아웃하는 데이터 형식입니다. 그러나 Javascript가 코드에서 이러한 구조를 나타낼 수 있는 유일한 언어는 아닙니다. 저는 일반적으로 '객체'{}...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.