Jump to content
  • Advertisement
Sign in to follow this  
Yamian

Build Error 1?

This topic is 5463 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've been trying to compile a file originally intended for vc++6 and am trying to use it in Dev-C++. I figured out a lot of the errors except this one. Build Error 1. What does it mean? How can I fix it?

Share this post


Link to post
Share on other sites
Advertisement

#include <windows.h>
#include <gl\glut.h>

void Initialize();
void MouseHandler(int button, int state, int x, int y);
void KeyboardHandler(unsigned char key, int x, int y);
void MainMenuHandler(int option);
void Animate();
void Reshape(int width, int height);
void Display();

/****************************************************************************
main()

Setup GLUT and OpenGL, drop into the event loop
*****************************************************************************/

int main(int argc, char **argv)
{
// Setup the basic GLUT stuff
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);

// Create the window
glutInitWindowSize(1024, 768);
glutInitWindowPosition(100, 150);
glutCreateWindow("BOGLGP Chapter 1");

Initialize();

// Register the event callback functions
glutDisplayFunc(Display);
glutReshapeFunc(Reshape);
glutMouseFunc(MouseHandler);
glutKeyboardFunc(KeyboardHandler);
glutIdleFunc(Animate);

// At this point, control is relinquished to the GLUT event handler.
// Control is returned as events occur, via the callback functions.
glutMainLoop();

return 0;
} // end main()


/****************************************************************************
Initialize()

One time setup, including creating menus, creating a light, setting the
shading mode and clear color, and loading textures.
*****************************************************************************/

void Initialize()
{
// set up the only meny
int mainMenu;

mainMenu = glutCreateMenu(MainMenuHandler);

glutSetMenu(mainMenu);
glutAddMenuEntry("Exit", 0);
glutAttachMenu(GLUT_RIGHT_BUTTON);

glEnable(GL_DEPTH_TEST);
} // end Initialize()


/****************************************************************************
MouseHandler()

Handle mouse events. For this simple demo, just exit on a left click.
*****************************************************************************/

void MouseHandler(int button, int state, int x, int y)
{
switch (button)
{
case GLUT_LEFT_BUTTON:
{
exit(0);
} break;
default:
break;
}

// force a screen redraw
glutPostRedisplay();
} // end MouseHandler()


/****************************************************************************
KeyboardHandler()

Keyboard handler. Again, we'll just exit when q is pressed.
*****************************************************************************/

void KeyboardHandler(unsigned char key, int x, int y)
{
switch (key)
{
case 'q': // exit
{
exit(0);
} break;
default:
{
} break;
}
glutPostRedisplay();
} // end KeyboardHandler()


/****************************************************************************
MainMenuHandler()

Main menu callback.
*****************************************************************************/

void MainMenuHandler(int option)
{
switch(option)
{
case 0:
{
exit(0);
} break;
default:
break;
}
glutPostRedisplay();
} // end MainMenuHandler()


/****************************************************************************
Animate()

Rotate the cube by 4 degrees and force a redisplay.
*****************************************************************************/

void Animate()
{
glutPostRedisplay();
} // end Animate()


/****************************************************************************
Reshape()

Reset the viewport for window changes
*****************************************************************************/

void Reshape(int width, int height)
{
if (height == 0)
return;

glViewport(0, 0, (GLsizei) width, (GLsizei) height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(90.0, width/height, 1.0, 100.0);

glMatrixMode(GL_MODELVIEW);
} // end Reshape


/****************************************************************************
Display()

Clear and redraw the scene.
*****************************************************************************/

void Display()
{
// set up the camera
glLoadIdentity();
gluLookAt(0.0, 1.0, 6.0,
0.0, 0.0, 0.0,
0.0, 1.0, 0.0);

// clear the screen
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

// draw a triangle
glBegin(GL_TRIANGLES);
glColor3f(1.0, 0.0, 0.0);
glVertex3f(2.0, 2.5, -1.0);
glColor3f(0.0, 1.0, 0.0);
glVertex3f(-3.5, -2.5, -1.0);
glColor3f(0.0, 0.0, 1.0);
glVertex3f(2.0, -4.0, 0.0);
glEnd();

// draw a polygon
glBegin(GL_POLYGON);
glColor3f(1.0, 1.0, 1.0);
glVertex3f(-1.0, 2.0, 0.0);
glColor3f(1.0, 1.0, 0.0);
glVertex3f(-3.0, -0.5, 0.0);
glColor3f(0.0, 1.0, 1.0);
glVertex3f(-1.5, -3.0, 0.0);
glColor3f(0.0, 0.0, 0.0);
glVertex3f(1.0, -2.0, 0.0);
glColor3f(1.0, 0.0, 1.0);
glVertex3f(1.0, 1.0, 0.0);
glEnd();

// draw everything and swap the display buffer
glutSwapBuffers();
} // end Display()




I linked the liabraries glut32.lib and opengl32.lib

Note: I did not write this, it is in the Beginning OpenGL Game Programming book.

[Edited by - evolutional on September 25, 2004 10:56:51 AM]

Share this post


Link to post
Share on other sites
Which line does the error occur on and what's the text of the error?

And please use source tags when posting a lot of source (I added them for you this time).

Share this post


Link to post
Share on other sites
What are the tabs for it? Here's the error. The error was not on a line and I discluded all the directory information for privacy reasons.

Makefile.win [Build Error] [Simple.exe] Error 1

Share this post


Link to post
Share on other sites
Oh, I guess you don't need opengl32.lib because if I take that away there is no dif. I hope this book doesn't become worthless because I can't compile any of it's examples.

Share this post


Link to post
Share on other sites
usually just hitting the rebuild all button will remove it, unless it is looking for a resource, is the recource tab blinking?

EDIT: or did you make a C project instead of a C++ one, and mingw(what dev uses) doesnt use .libs, you should be linking with -lopengl32 -lglu32 if you want opengl.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!