Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Ok im back with another problem...

Ok im back with another problem...

Scheduled Pinned Locked Moved C / C++ / MFC
helpcsharpc++asp-netvisual-studio
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 14015010
    wrote on last edited by
    #1

    Hello guys I'm trying to code in opengl so if anyone could help ill be posting info below code:

    #include
    #include

    #include

    #include
    #include
    using namespace glm;

    int main(){

    glewExperimental = true;
    if( !glfwInit() )
    {
    	fprintf( stderr, "Failed to initialize GLFW\\n" );
    	return -1;
    }
    
    glfwWindowHint(GLFW\_CONTEXT\_VERSION\_MAJOR, 3); // We want OpenGL 3.3
    glfwWindowHint(GLFW\_CONTEXT\_VERSION\_MINOR, 3);
    glfwWindowHint(GLFW\_OPENGL\_FORWARD\_COMPAT, GL\_TRUE); // To make MacOS happy; should not be needed
    glfwWindowHint(GLFW\_OPENGL\_PROFILE, GLFW\_OPENGL\_CORE\_PROFILE); // We don't want the old OpenGL
    
    GLFWwindow\* window;
    window = glfwCreateWindow( 1024, 768, "Tutorial 01", NULL, NULL);
    if( window == NULL ){
    	fprintf( stderr, "Failed to open GLFW window. if you have an intel gpu they are not 3.3 compatible try the 2.1 version of the tutorials.\\n" );
    	glfwTerminate();
    return -1;
    

    }
    glfwMakeContextCurrent(window); // Initialize GLEW
    glewExperimental=true; // Needed in core profile
    if (glewInit() != GLEW_OK) {
    fprintf(stderr, "Failed to initialize GLEW\n");
    return -1;
    }

    glfwSetInputMode(window, GLFW_STICKY_KEYS, GL_TRUE);

    do{
    // Clear the screen. It's not mentioned before Tutorial 02, but it can cause flickering, so it's there nonetheless.
    glClear( GL_COLOR_BUFFER_BIT );

    // Draw nothing, see you in tutorial 2 !
    
    // Swap buffers
    glfwSwapBuffers(window);
    glfwPollEvents();
    

    } // Check if the ESC key was pressed or the window was closed
    while( glfwGetKey(window, GLFW_KEY_ESCAPE ) != GLFW_PRESS &&
    glfwWindowShouldClose(window) == 0 );

    }

    error:

    1>------ Rebuild All started: Project: opengl, Configuration: Debug Win32 ------
    1> lov.cpp
    1>MSVCRTD.lib(crtexe.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup
    1>C:\Users\trogd\documents\visual studio 2010\Projects\opengl\Debug\opengl.exe : fatal error LNK1120: 1 unresolved externals
    ========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

    codeproject is what keeps me going :P

    L L 2 Replies Last reply
    0
    • U User 14015010

      Hello guys I'm trying to code in opengl so if anyone could help ill be posting info below code:

      #include
      #include

      #include

      #include
      #include
      using namespace glm;

      int main(){

      glewExperimental = true;
      if( !glfwInit() )
      {
      	fprintf( stderr, "Failed to initialize GLFW\\n" );
      	return -1;
      }
      
      glfwWindowHint(GLFW\_CONTEXT\_VERSION\_MAJOR, 3); // We want OpenGL 3.3
      glfwWindowHint(GLFW\_CONTEXT\_VERSION\_MINOR, 3);
      glfwWindowHint(GLFW\_OPENGL\_FORWARD\_COMPAT, GL\_TRUE); // To make MacOS happy; should not be needed
      glfwWindowHint(GLFW\_OPENGL\_PROFILE, GLFW\_OPENGL\_CORE\_PROFILE); // We don't want the old OpenGL
      
      GLFWwindow\* window;
      window = glfwCreateWindow( 1024, 768, "Tutorial 01", NULL, NULL);
      if( window == NULL ){
      	fprintf( stderr, "Failed to open GLFW window. if you have an intel gpu they are not 3.3 compatible try the 2.1 version of the tutorials.\\n" );
      	glfwTerminate();
      return -1;
      

      }
      glfwMakeContextCurrent(window); // Initialize GLEW
      glewExperimental=true; // Needed in core profile
      if (glewInit() != GLEW_OK) {
      fprintf(stderr, "Failed to initialize GLEW\n");
      return -1;
      }

      glfwSetInputMode(window, GLFW_STICKY_KEYS, GL_TRUE);

      do{
      // Clear the screen. It's not mentioned before Tutorial 02, but it can cause flickering, so it's there nonetheless.
      glClear( GL_COLOR_BUFFER_BIT );

      // Draw nothing, see you in tutorial 2 !
      
      // Swap buffers
      glfwSwapBuffers(window);
      glfwPollEvents();
      

      } // Check if the ESC key was pressed or the window was closed
      while( glfwGetKey(window, GLFW_KEY_ESCAPE ) != GLFW_PRESS &&
      glfwWindowShouldClose(window) == 0 );

      }

      error:

      1>------ Rebuild All started: Project: opengl, Configuration: Debug Win32 ------
      1> lov.cpp
      1>MSVCRTD.lib(crtexe.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup
      1>C:\Users\trogd\documents\visual studio 2010\Projects\opengl\Debug\opengl.exe : fatal error LNK1120: 1 unresolved externals
      ========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

      codeproject is what keeps me going :P

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      It appears that VS is trying to link before compiling, hence the message as the entry point _main should be created by compiling the above source into its object code. Check your project build settings.

      1 Reply Last reply
      0
      • U User 14015010

        Hello guys I'm trying to code in opengl so if anyone could help ill be posting info below code:

        #include
        #include

        #include

        #include
        #include
        using namespace glm;

        int main(){

        glewExperimental = true;
        if( !glfwInit() )
        {
        	fprintf( stderr, "Failed to initialize GLFW\\n" );
        	return -1;
        }
        
        glfwWindowHint(GLFW\_CONTEXT\_VERSION\_MAJOR, 3); // We want OpenGL 3.3
        glfwWindowHint(GLFW\_CONTEXT\_VERSION\_MINOR, 3);
        glfwWindowHint(GLFW\_OPENGL\_FORWARD\_COMPAT, GL\_TRUE); // To make MacOS happy; should not be needed
        glfwWindowHint(GLFW\_OPENGL\_PROFILE, GLFW\_OPENGL\_CORE\_PROFILE); // We don't want the old OpenGL
        
        GLFWwindow\* window;
        window = glfwCreateWindow( 1024, 768, "Tutorial 01", NULL, NULL);
        if( window == NULL ){
        	fprintf( stderr, "Failed to open GLFW window. if you have an intel gpu they are not 3.3 compatible try the 2.1 version of the tutorials.\\n" );
        	glfwTerminate();
        return -1;
        

        }
        glfwMakeContextCurrent(window); // Initialize GLEW
        glewExperimental=true; // Needed in core profile
        if (glewInit() != GLEW_OK) {
        fprintf(stderr, "Failed to initialize GLEW\n");
        return -1;
        }

        glfwSetInputMode(window, GLFW_STICKY_KEYS, GL_TRUE);

        do{
        // Clear the screen. It's not mentioned before Tutorial 02, but it can cause flickering, so it's there nonetheless.
        glClear( GL_COLOR_BUFFER_BIT );

        // Draw nothing, see you in tutorial 2 !
        
        // Swap buffers
        glfwSwapBuffers(window);
        glfwPollEvents();
        

        } // Check if the ESC key was pressed or the window was closed
        while( glfwGetKey(window, GLFW_KEY_ESCAPE ) != GLFW_PRESS &&
        glfwWindowShouldClose(window) == 0 );

        }

        error:

        1>------ Rebuild All started: Project: opengl, Configuration: Debug Win32 ------
        1> lov.cpp
        1>MSVCRTD.lib(crtexe.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup
        1>C:\Users\trogd\documents\visual studio 2010\Projects\opengl\Debug\opengl.exe : fatal error LNK1120: 1 unresolved externals
        ========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

        codeproject is what keeps me going :P

        L Offline
        L Offline
        leon de boer
        wrote on last edited by
        #3

        You have setup a Console project to what is a Win GUI code or vice vesa. When you first setup the project you had two choices windows console or windows GUI you selected the wrong one, whatever the case. Not sure why you are staying on VS2010 rather than updating as it's free but on VS2017 You can change it after you make the project via Project -> Properties -> Configuration Properties -> Linker -> System It will be something similar on VS2010 and what you are after is subsystem and it will be either Windows (/SUBSYSTEM:WINDOWS) OR Console (/SUBSYSTEM:CONSOLE) Whichever one it is on currently it's wrong for the project, select the other.

        In vino veritas

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups