我正在遵循HOWTOBUILD.txt的步骤。 我已经build立了glfw的必要文件。 链接器第一次抱怨glfw。 search后,似乎我需要链接到gl3w 看到这个环节 。 我已经为gl3w生成了静态库。 现在,我已经打开了一个新的项目,并包含了包含的path,请参阅下面的图片。
对于链接器,我链接到glfw3dll.lib gl3w.lib opengl32.lib并包含它们的path。 如果我从第一章开始做样本,
main.cpp
旧的Fortran程序:ld返回1退出状态
visual studio 2010 express + win sdk =无法打开input文件'kernel32.lib'
使用VS 2008的Windows上的Apache 2.4链接器错误
在Linux中链接Boost库
#include "sb7.h" class my_application : public sb7::application { void render(double currentTime) { static const GLfloat red[] = { 1.0f,0.0f,1.0f }; glClearBufferfv(GL_COLOR,red); } }; DECLARE_MAIN(my_application);
1>main.obj : error LNK2019: unresolved external symbol "int __cdecl sb6IsExtensionSupported(char const *)" (?sb6IsExtensionSupported@@YahpBD@Z) referenced in function "public: virtual void __thiscall sb7::application::run(class sb7::application *)" (?run@application@sb7@@UAEXPAV12@@Z) 1>main.obj : error LNK2019: unresolved external symbol "private: static void __stdcall sb7::application::debug_callback(unsigned int,unsigned int,int,char const *,void *)" (?debug_callback@application@sb7@@CGXIIIIHPBDpax@Z) referenced in function "public: virtual void __thiscall sb7::application::run(class sb7::application *)" (?run@application@sb7@@UAEXPAV12@@Z) 1>main.obj : error LNK2001: unresolved external symbol "protected: static class sb7::application * sb7::application::app" (?app@application@sb7@@1PAV12@A) 1>MSVCRTD.lib(crtexe.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup
我正在使用Visual Studio 2013.我追溯了链接器所抱怨的函数之一(即sb6IsExtensionSupported() ),下面的图片展示了如何在sb7.h中调用这个函数, sb7.cpp 。
这实际上是正确的吗?
如何在失败的编译中find缺失的依赖项?
符号查找错误(linux – c ++)
我收到错误“LINK:错误LNK2001:无法parsing的外部符号_WinMainCRTStartup”
我已经解决了这个问题。 看来有一个静态库,我必须链接并升级我的图形卡驱动程序。 基本上,这是我做的。
第一步:(建设GLFW)
如果你已经建好了图书馆,那么你不必这样做,但是当你建立例子的时候,你需要把路径设置成GLFW。 为了节省您的时间,也建立GLFW。 为此,
1- install cmake. 2- Open the command prompt and navigate to extern/glfw-3.0.4 (using cd command) 3- Type in command prompt: cmake -G "Visual Studio 12" 4- Open GLFW.sln and build all ( do it for Debug and Release modes) 5- copy `glfw-3.0.4/src/Debug/glfw3.lib` into the `lib` directory and rename it to glfw3_d.lib. 6- copy `glf3-3.0.4/src/Release/glfw3.lib` into the `lib` directory but don't rename it.
第二步:(建筑样品)
1- Open the command prompt and navigate to "build" folder 2- Type in command prompt: cmake -G "Visual Studio 12" .. 3- Open superbible7.sln in build folder and build all. (do it for Debug and Release modes).
运行示例
现在在lib文件夹中,有sb7.lib和sb7_d.lib 。 _d表示调试模式。 在我的情况下,这是造成这个问题,因此,你需要链接它。 打开新项目,添加sb7 include和glfw的路径
C++->General-> Additional Include Directories
D:CPP_ProjectsVisualStudioModern OpenGLsb7code-mastersb7code-masterinclude D:CPP_Librariesglfw-3.1.1glfw-3.1.1include
对于链接器,
Linker->General->Additional Libraries Directories
D:CPP_Librariesglfw-3.1.1glfw-3.1.1installsrcDebug D:CPP_ProjectsVisualStudioModern OpenGLGLFWOpenGLSuperBible_7thOpenGLSuperBibleChapterOneDebug
Linker->Input->Additional Dependencies
sb7_d.lib glfw3dll.lib opengl32.lib glu32.lib
结果是
非常重要的信息:
在我的情况下,显卡支持OpenGL 4.1。 根据readme.txt ,
请注意:即使您可以为您最喜欢的平台创建源,您也需要使用最新的OpenGL 4.x驱动程序来运行它们。 请勿打开本书,因为您的计算机不支持OpenGL 4.x. 谢谢
在我的情况下, GLFW_OPENGL_CORE_PROFILE出现问题,因此我需要升级显卡驱动程序。 我已经下载了这个软件的OpenGL扩展查看器 ,它显示我支持的opengl版本。 我的显示适应性是AMD mobility Radeon HD 5000.我访问了他们的网站,并下载了我的显示器的最新驱动程序。 事实上,我的显卡现在支持OpenGL 4.4,这是一个快照
您注意到有一个检查更新驱动程序的按钮。 在我的情况下,它导致我到一个断开的链接,因此,你需要去的网站,并检查您的显示适应的最新更新。 谢谢。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。