C++ OpenGl-引用的未解析外部符号

C++ OpenGl-引用的未解析外部符号,c++,opengl,linker-errors,C++,Opengl,Linker Errors,编辑: 在发现sb6头使用Windows子系统后,我将子系统从控制台(/subsystem:Console)更改为Windows(/subsystem:Windows) 当我编译这段代码时 // Include the "sb6.h" header file #include "sb6.h" // Derive my_application from sb6::application class my_application : public sb6::application { public:

编辑: 在发现sb6头使用Windows子系统后,我将子系统从控制台(/subsystem:Console)更改为Windows(/subsystem:Windows)

当我编译这段代码时

// Include the "sb6.h" header file
#include "sb6.h"
// Derive my_application from sb6::application
class my_application : public sb6::application
{
public:
    // Our rendering function
    void render(double currentTime)
    {
        // Simply clear the window with red
        static const GLfloat red[] = { 1.0f, 0.0f, 0.0f, 1.0f };
        glClearBufferfv(GL_COLOR, 0, red);
    }
};
// Our one and only instance of DECLARE_MAIN
DECLARE_MAIN(my_application);
我得到这些错误

LNK2019 unresolved external symbol __imp____iob_func referenced in function __glfwPlatformOpenWindow

LNK4217 locally defined symbol _fprintf imported in function __glfwPlatformOpenWindow

我确实将所有库和包含文件夹链接到了VC++目录,而且我在包含所有预处理器的正确子系统中。

看起来您正在尝试在Visual Studio 2015中构建项目,它的一些依赖项是由Visual Studio早期版本创建的静态库。在这个版本中,C运行时被显著重构,其ABI向后兼容性被破坏


至于您的案例,我怀疑您使用的是第6版,而第6版又使用了VisualStudio2010构建的GLFW库。您需要从下载GLFW的最新版本。您可以为Visual Studio 2015使用预构建的二进制文件,也可以从其源代码中构建它们。

看起来您正在尝试在Visual Studio 2015中构建项目,它的一些依赖项是由Visual Studio早期版本创建的静态库。在这个版本中,C运行时被显著重构,其ABI向后兼容性被破坏


至于您的案例,我怀疑您使用的是第6版,而第6版又使用了VisualStudio2010构建的GLFW库。您需要从下载GLFW的最新版本。您可以使用Visual Studio 2015的预构建二进制文件,也可以从其源代码中构建它们。

检查此项,可能有帮助:检查此项,可能有帮助: