PDA

View Full Version : strange MSVC errors



JLawson
10-23-2001, 06:28 PM
everything is set up fine.

I get an error that says

Linking...
LINK : warning LNK4089: all references to "OPENGL32.dll" discarded by /OPT:REF

when I try to build (it compiles fine) the following code:

#include <windows.h>
#include <gl/glut.h>
#include <gl/glu.h>
#include <gl/gl.h>

//FUNCTION DECLARATIONS
void initGL(void);
void keyDown(unsigned char key, int x, int y);

//MAIN FUNCTION
void main(int argc, char **argv){
glutInit(&argc, argv);
glutInitDisplayMode(GL_DEPTH|GL_DOUBLE|GL_RGBA);
glutInitWindowPosition(1,1);
glutInitWindowSize(320,320);
glutFullScreen();
glutKeyboardFunc(keyDown);
glutMainLoop();
}

//KEYPRESS FUNCTION
void keyDown(unsigned char key, int x, int y){
switch(key){
case 27: exit(1); break;
default: break;
}
}

//RENDER SCENE
void initGL(void){
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glEnable(GL_DEPTH_TEST);
glEnable(GL_LIGHTING);

//Now make an instance of light, and declare its position
glEnable(GL_LIGHT1); static GLfloat Light1Pos[]={0.0,0.0,1.0, 0.0};

glLightfv(GL_LIGHT1, GL_POSITION, Light1Pos);
glColor4f(1.0f, 1.0f, 1.0f, 0.5f);
glBegin(GL_QUADS);
glVertex3f(-5.0, 5.0, 0.0);
glVertex3f(-5.0,-5.0, 0.0);
glVertex3f( 5.0, 5.0, 0.0);
glVertex3f( 5.0,-5.0, 0.0);
glEnd();
glutSwapBuffers();
}

What exactly is it saying?

Screaming Lunatic
10-23-2001, 09:00 PM
Straight out of MSDN:

Linker Tools Warning LNK4089
all references to "dynamic-link library" discarded by /OPT:REF

The linker discarded all packaged functions that referenced exports in dynamic-link library. As a result, dynamic-link library and its import library are unneeded.


Also straight out of MSDN:


This option controls the optimizations that LINK performs during a build. Optimizations generally decrease the image size and increase the program speed, at a cost of increased link time.

Use /OPT:REF to eliminate functions and/or data that is never referenced.


The moral of the story: When using MSVC, MSDN is your friend.

SL

FoxDie
10-23-2001, 09:27 PM
Try to select the debug(linker) from RELEASE to DEBUG.