-2

I'm learning OpenGL using superbible 6th edition and while compiling this code:

#include <iostream>
#include "sb6.h"

class my_application : public sb6::application
{
public:
    void render(double currentTime)
    {
        static const GLfloat red[] = { 1.0f,0.0f,0.0f,1.0f };
        glClearBufferfv(GL_COLOR, 0, red);
    }
};
DECLARE_MAIN(my_application); 

I'm getting a linking errors saying cannot open sb6_d32.lib
I searched the entire sb6 directory there is no sb6_d32.lib file available for it to open so that i can link it? Am i missing something?

Edit: 2 Unresolved externals

Severity    Code    Description Project File    Line    Suppression State
Error   LNK2019 unresolved external symbol _main referenced in function "int __cdecl invoke_main(void)" (?invoke_main@@YAHXZ)   OpenGL_learning E:\C++\Learning\OpenGL\OpenGL_learning\OpenGL_learning\MSVCRTD.lib(exe_main.obj)    1   

Severity    Code    Description Project File    Line    Suppression State
Error   LNK2019 unresolved external symbol __imp____iob_func referenced in function __glfwPlatformOpenWindow    OpenGL_learning E:\C++\Learning\OpenGL\OpenGL_learning\OpenGL_learning\GLFW_d32.lib(win32_window.obj)   1   
psrag anvesh
  • 1,257
  • 2
  • 12
  • 18

1 Answers1

0

You have to build it first. See HOWTOBUILD.txt file in your examples folder root:

Windows / Microsoft Visual Studio 2010:

Project files are included in the source archive for Visual Studio 2010. These will work with Professional (all tiers) and Express editions. Newer versions of Visual Studio should import them just fine, but this is not extensively tested. Simply open the sb6.sln file in Visual Studio and hit build (F7). Evertything will build and you'll end up with binaries in the 'bin' directory.

Update: Unresolved externals.

LNK2019 unresolved external symbol _main referenced in function "int __cdecl invoke_main(void)" (?invoke_main@@YAHXZ)

Lets see DECLARE_MAIN macro implementation in the sb6.h:

#if defined _WIN32
#define DECLARE_MAIN(a)                             \
sb6::application *app = 0;                          \
int CALLBACK WinMain(HINSTANCE hInstance,           \
                     HINSTANCE hPrevInstance,       \
                     LPSTR lpCmdLine,               \
                     int nCmdShow)                  \
{                                                   \
    a *app = new a;                                 \
    app->run(app);                                  \
    delete app;                                     \
    return 0;                                       \
}

If you want to use this macro, your program should be compiled as windows application (/SYBSYSTEM:WINDOWS), you are creating console application which is not supported. Change subsystem in your project settings (Linker/System).

LNK2019 unresolved external symbol __imp____iob_func referenced in function __glfwPlatformOpenWindow

See this for the ways to solve that problem. In short you have to recompile all used static libraries with your version of Visual Studio.

Community
  • 1
  • 1
Ari0nhh
  • 5,720
  • 3
  • 28
  • 33