1

I want to use GLUT to simplify my code and work.

I'm using windows 7 (64 bit) and Visual Studio 2010. I did everything like in this tutorial and still can't compile my code... I get these errors:

Error 2 error LNK1120: 1 unresolved externals <path>
Error   1   error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartuL  

The code I use:

#include <GL/glew.h> 
#include <GL/glut.h> 

void display (void) {  
   glClearColor(1.0f, 0.0f, 0.0f, 1.0f);  
   glClear(GL_COLOR_BUFFER_BIT); 
   glLoadIdentity(); 

   glFlush(); 
}  

int main (int argc, char **argv) {  
   glutInit(&argc, argv); 
   glutInitDisplayMode (GLUT_SINGLE); 
   glutInitWindowSize (500, 500); 
   glutInitWindowPosition (100, 100); 
   glutCreateWindow ("Your first OpenGL Window");  

   glutDisplayFunc(display); /

   glutMainLoop(); 
} 

Does someone know whats the problem and how to fix it?

genpfault
  • 51,148
  • 11
  • 85
  • 139
L3M0L
  • 429
  • 8
  • 23

1 Answers1

1

Seems that your created Windows application instead of a Console one. See the pic below for how to change/choose the Windows subsystem

enter image description here

Shmil The Cat
  • 4,548
  • 2
  • 28
  • 37
  • Thanks man! That helped! Love you :)) However now when i run the program the window shows up with the console window in background... can i edit it somehow that the console won't apear? – L3M0L Mar 15 '13 at 21:04
  • Try plugging this to your main() preamble HWND hWnd = ::GetConsoleWindow(); ::ShowWindow( hWnd, SW_HIDE ); – Shmil The Cat Mar 15 '13 at 21:09
  • @ShmilTheCat: While this works, it's not the best solution. A much nicer solution I did describe at http://stackoverflow.com/a/6882500/524368 – datenwolf Mar 16 '13 at 01:15
  • @L3M0L: Another way to get rid of the console window: http://stackoverflow.com/a/6882500/524368 – datenwolf Mar 16 '13 at 01:16