Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7805415
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T02:13:12+00:00 2026-06-02T02:13:12+00:00

I am compiling this OpenGL program in Visual Studio. I have set it up

  • 0

I am compiling this OpenGL program in Visual Studio. I have set it up properly, after reading numerous articles. I have added the correct libraries to linker’s additional dependencies. However I am getting this error:

error LNK2019: unresolved external symbol WinMain@16 referenced in function __tmainCRTStartup

The code I am compiling is:

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

void init(void) 
{
   glClearColor (0.0, 0.0, 0.0, 0.0);
   glShadeModel (GL_FLAT);
}

void display(void)
{
   glClear (GL_COLOR_BUFFER_BIT);
   glColor3f (1.0, 1.0, 1.0);
   glLoadIdentity ();             /* clear the matrix */
           /* viewing transformation  */
   gluLookAt (0.0, 0.0, 5.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);
   glScalef (1.0, 2.0, 1.0);      /* modeling transformation */ 
   glutWireCube (1.0);
   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, 1.5, 20.0);
   glMatrixMode (GL_MODELVIEW);
}

int main(int argc, char** argv)
{
   glutInit(&argc, argv);
   glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);
   glutInitWindowSize (500, 500); 
   glutInitWindowPosition (100, 100);
   glutCreateWindow (argv[0]);
   init ();
   glutDisplayFunc(display); 
   glutReshapeFunc(reshape);
   glutMainLoop();
   return 0;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T02:13:13+00:00Added an answer on June 2, 2026 at 2:13 am

    There are two kind of executables in Windows:

    1. Console
    2. GUI (Windows)

    Only difference is that Console executables automatically opens console window, and C/C++ CRT runtime associates standart stdout/stdin/stderr handles to go to this window. Otherwise there are no differences between these two executable types – both can create new Windows, draw things, use OpenGL, etc…

    In visual Studio, if you create Console application – then it expects your entry point to be called “main”. But for GUI application it expects entry point function to be called “WinMain”. So you have two options if you don’t want to see Console window when your application starts:

    1. Change project linker settings to indicate you are building GUI application (Project Properties -> Linker -> System -> Subystem = Windows). This will require your entry point function to be called WinMain: http://msdn.microsoft.com/en-us/library/ff381406.aspx
    2. Indicate to linker that even if you want to use GUI application, but you want your entry point to be called “main”. You can do that in Project Properties -> Linker -> Advanced -> Entry Point = mainCRTStartup. Don’t put there main. Put there mainCRTStartup – it is special C/C++ CRT function that initializes standard C library and calls your main function automatically. Heres the documentation about this setting: http://msdn.microsoft.com/en-us/library/f9t8842e.aspx

    Using second options means, that you can use GLUT, have your entry point called “main” and have no Console window opened at startup.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider the following C program, 'pause.c': void main() { pause(); } Compiling this on
While compiling a program in Java I got this big WARNING warning: [unchecked] unchecked
Recently I tried compiling program something like this with GCC: int f(int i){ if(i<0){
I'm have horrendous problems trying to get a JOGL program compiling using Netbeans 6.9.
I'm creating a kinect project in Visual Studio 2008 using OpenNi, NITE and OpenGL.
I have to implement VBOs in a very old OpenGL program made in Broldand
When I'm compiling the Triangle project from the opengl superbible 5th ed I've this
I'm compiling an example program that uses opengl in ubuntu (linux). A short snippet
I have some problems with compiling hello world application in kubuntu linux 11.10. This
i have a program that does some GPU computing with Optional OpenGL rendering. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.