0

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!

Community
  • 1
  • 1
C.Jerry
  • 11
  • 3
  • it's an evident linker problem. Are you sure you can successfully link the lib file? I see the pragma for inclusion. Are you sure the file is called glew32d.lib? I usually prefer to link with the -l directive, but to be honest both ways should work – Maurizio Benedetti Apr 19 '16 at 12:28
  • I'm pretty sure I link the lib file.Because I can use the glew methods at first. And the file is glew32s.lib(means its static link) not the glew32d.lib. – C.Jerry Apr 19 '16 at 13:05
  • Am I wrong or you refer to the dynamic version? #pragma comment( lib, "glew32d.lib" ) – Maurizio Benedetti Apr 19 '16 at 13:09
  • I'm sorry that I write my code wrongly. But I do use the glew32s.lib. And I include my glew32s.lib in C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\lib. And I declare it in my project (glew32s.lib). Sorry to make you misled. – C.Jerry Apr 19 '16 at 13:35

0 Answers0