I have problem with my glew library configuration.
I use glew32s.lib and I don't include glew32.lib and its dll files.(vs 2013 glew 1.13.0)
I can run my glew test program as followings.
#define GLEW_STATIC
#include <GL/glew.h>
#include <GL/glut.h>
#include <stdio.h>
void init() {
glClearColor( 1.0, 1.0, 1.0, 0.0 );
glMatrixMode( GL_PROJECTION );
gluOrtho2D( 0.0, 200.0, 0.0, 150.0 );
}
void drawLine() {
glClear( GL_COLOR_BUFFER_BIT );
glEnable( GL_LINE_STIPPLE );
GLushort patn = 0xFAFA;
glLineStipple( 3, patn );
glColor3f( 1.0, 0.0, 0.0 );
glBegin( GL_LINE_LOOP );
glVertex2i( 10, 10 );
glVertex2f( 100.0, 75.3 );
glColor3f( 0.0, 1.0, 0.0 );
glVertex2i( 70, 80 );
glEnd();
glFlush();
}
int main( int argc, char** argv ) {
glutInit( &argc, argv );
glutInitDisplayMode( GLUT_SINGLE | GLUT_RGB );
glutInitWindowPosition( 200, 200 );
glutInitWindowSize( 400, 300 );
glutCreateWindow( "第一个demo" );
GLenum err = glewInit();
if( err != GLEW_OK ) {
fprintf( stderr, "%s\n", glewGetErrorString( err ) );
return -1;
}
init();
glutDisplayFunc( drawLine );
glutMainLoop();
return 0;
}
But when I try to add more code (I try to code with cuda) and run the code from the Internet(https://github.com/mmmovania/opencloth/tree/master/bin).
When the project only have the test codes as shown, it runs as usually. When I add cu codes, it will get errors.
Then the compiler tells that:
Error 2 error LNK2019: unresolved external symbol _glewinit,referenced in function _main clothverlet
the code get wrong at these codes:
void main(int argc, char** argv) {
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH);
glutInitWindowSize(width, height);
glutCreateWindow("GLUT Cloth Demo [Comparing Verlet Integration on CPU, GLSL, CUDA and OpenCL]");
glutDisplayFunc(OnRender);
glutReshapeFunc(OnReshape);
glutIdleFunc(OnIdle);
glutMouseFunc(OnMouseDown);
glutMotionFunc(OnMouseMove);
glutKeyboardFunc(OnKey);
glutCloseFunc(OnShutdown);
glewInit();
InitGL();
glutMainLoop();
}
I try to delete the glewInit(); then the compiler can make through but when I run the program, it still get wrong in other glew methods, like:
glcreatprogram -> glewcreatprogram
I was new to glew and cuda. I think it has something to do with my cu code.
I referred to LNK2019 glewInit, but cannot get help.
Thanks a lot if you can offer any help!
thanks,I found that my project has 2 folders named GL, they collided. Hope I won't make this mistake again!