Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: Linkererror unresolved symbol __imp_glClearColor

  1. #1
    Junior Member Newbie
    Join Date
    Sep 2017
    Posts
    3

    Question Linkererror unresolved symbol __imp_glClearColor

    Hello together,
    I am very new to openGL and did a websearch a few days ago to find some tutorials with openGL and found something on youtube. Now I have a little problem:
    When I try to call the function glClearColor I am getting a Linkererror that says that __imp_ClearColor() can't be resolved. I am using GLEW and SDL.
    I linked to all .lib files, but it is still not working. I found some posts, that I need an openGL32.lib file which contains this function, but I couldn't find something like that. It would be very nice if you can help me. I post the code of my project here, sorry when this is a little not formated, but I couldn't find a code editor on this page. I am just posting the .ccp file from my class, the rest is working fine:

    Code cpp:
    #pragma once
    #include "gameEngine.h"
    #include <iostream>
    // glew.h and SDL.h is included in the .h file!
     
    gameEngine::gameEngine()
    {
      window = nullptr;
      screenWidth = 1024;
      screenHight = 760;
      currentGameState = gameState::PLAY;
    }
     
    gameEngine::~gameEngine()
    {
     
    }
     
    void gameEngine::run()
    {
      init();
      gameLoop();
    }
     
    void gameEngine::init()
    {
      SDL_Init(SDL_INIT_EVERYTHING);
      window = SDL_CreateWindow("OpenGL Test", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, screenWidth, screenHight, SDL_WINDOW_OPENGL);
     
      glewInit();
      SDL_GLContext glContext = SDL_GL_CreateContext(window);
     
      glClearColor(0.0f, 1.0f, 0.25f, 1.0f);
      SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
     
    }
     
    void gameEngine::gameLoop()
    {
      while(currentGameState != gameState::EXIT) {
        getInput();
      }
    }
     
    void gameEngine::getInput()
    {
      SDL_Event evnt;
      while (SDL_PollEvent(&evnt) == 1) {
     
        switch (evnt.type) {
        case SDL_QUIT:
          currentGameState = gameState::EXIT;
          break;
        case SDL_MOUSEMOTION:
          std::cout << "X: " << evnt.motion.x << " " << "Y: " << evnt.motion.y << "\n";
        break;
     
        }
      }
    }
     
    void gameEngine::drawTriangle()
    {
      glClearDepth(1.0);
      glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
     
     
    }

    Thanks in Advance!

    Best regards,
    Daniel
    Last edited by Dark Photon; 09-28-2017 at 07:00 PM.

  2. #2
    Junior Member Newbie
    Join Date
    Sep 2017
    Posts
    3
    Hello together,

    Although nobody answered, I want to say that I could fix the problem and it was even easier then you could think of. I just interpreted openGL wrong. I made the mistake to think openGL is really a library 'till I noticed that it is from the drivers from the graphic cards and is installed on every computer. So I could just add opengl.lib to the additional libraries and now it is working.

    Thanks for your help!

    Regards,
    Daniel

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •