Thread: Problems with glut/opengl.

  1. #1
    Student drdroid's Avatar
    Join Date
    Feb 2002
    Location
    Montreal, Quebec
    Posts
    669

    Question Problems with glut/opengl.

    I get these errors: LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
    Debug/Test.exe : fatal error LNK1120: 1 unresolved externals
    Error executing link.exe. When I try and execute this program. I've looked in my code, and experimented, but nothing works. Is it in my code? I tried recompiling the entire thing from scratch. That didn't work either. I'm going to be on aim for a while so im me please if you think you can help.

    Code:
    #pragma comment(lib, "opengl32.lib")
    #pragma comment(lib, "glu32.lib")
    #pragma comment(lib, "glaux.lib")
    #pragma comment(lib, "glut32.lib")
    #pragma comment(linker, "/subsystem:windows")
    
    #include <windows.h>
    #include <GL/gl.h>
    #include <GL/glu.h>
    #include <GL/glaux.h>
    #include <GL/glut.h>
    #include <stdio.h>
    
    void draw()
    {
    	glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
    	glFlush();
    }
    
    void reshape(int w, int h)
    {
    	glViewport(0, 0, (GLsizei) w, (GLsizei) h);
    	glMatrixMode(GL_PROJECTION);
    	glLoadIdentity();
    	glFrustum(-1.0, 1.0, -1.0, 1.0, 0.0, 1.0);
    	glMatrixMode(GL_MODELVIEW);
    	glLoadIdentity();
    }
    
    void init(void)
    {
    	glEnable(GL_DEPTH_TEST);
        glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
        glShadeModel(GL_SMOOTH);
    }
    
    void main(void)
    {
    	glutInitDisplayMode(GL_DOUBLE | GL_RGB);
    	glutCreateWindow("Opengl");
    	glutDisplayFunc(draw);
    	glutReshapeFunc(reshape);
    
    	init();
    	glutMainLoop();
    }

  2. #2
    Registered User
    Join Date
    May 2003
    Posts
    148
    Replace the #pragma windows line with this one.
    Code:
    #pragma comment(linker, "/subsystem:console")

  3. #3
    drdrdoid
    Guest

    Question

    Now I get the error:

    Code:
    Glut: fatal error in(unknown): pixel format with necessary capabilities not found.

  4. #4
    Registered User
    Join Date
    May 2003
    Posts
    148
    Never worked with glut,but I think you forgot the init
    Code:
      glutInit(&argc, argv);
      glutInitWindowSize(640, 480);
    http://w3imagis.imag.fr/Membres/Sylv.../glux/doc.html.

  5. #5
    Student drdroid's Avatar
    Join Date
    Feb 2002
    Location
    Montreal, Quebec
    Posts
    669

    ...

    it get's the same error both ways... btw it's an in execution error. Not a compiler error. I did error checking and it doesn't even get to main.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. No clue how to make a code to solve problems!
    By ctnzn in forum C Programming
    Replies: 8
    Last Post: 10-16-2008, 02:59 AM
  2. C Pointers Problems
    By mhelal in forum C Programming
    Replies: 8
    Last Post: 01-10-2007, 06:35 AM
  3. Rendering problems (DirectX?)
    By OnionKnight in forum Tech Board
    Replies: 0
    Last Post: 08-17-2006, 12:17 PM
  4. contest problems on my site
    By DavidP in forum Contests Board
    Replies: 4
    Last Post: 01-10-2004, 09:19 PM
  5. DJGPP problems
    By stormswift in forum C Programming
    Replies: 2
    Last Post: 02-26-2002, 04:35 PM