can't compile samples of OpenGL Superbible 7th (unresolved external symbol)

时光总嘲笑我的痴心妄想 提交于 2019-12-04 07:33:20

I've solved the problem. It seems there is a static library that I have to link against and upgrade my Graphics card driver. Basically, this is I've done.

Step One: (Building GLFW)

If you have the library already built, then you don't have to do so but the problem when you build the examples, you need to set the path to GLFW properly. To save your time, build GLFW as well. To do so,

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.

Step Two: (Building Samples)

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). 

Running Examples

Now in lib folder, there is sb7.lib and sb7_d.lib. _d means debug mode. In my case, this was causing the problem, therefore, you need to link against it. Open new project, add the path to sb7 include and glfw

C++->General-> Additional Include Directories

D:\CPP_Projects\VisualStudio\Modern OpenGL\sb7code-master\sb7code-master\include
D:\CPP_Libraries\glfw-3.1.1\glfw-3.1.1\include

For the linker,

Linker->General->Additional Libraries Directories

D:\CPP_Libraries\glfw-3.1.1\glfw-3.1.1\install\src\Debug
D:\CPP_Projects\VisualStudio\Modern OpenGL\GLFW\OpenGLSuperBible_7th\OpenGLSuperBible\ChapterOne\Debug

Linker->Input->Additional Dependencies

sb7_d.lib
glfw3dll.lib
opengl32.lib
glu32.lib

The result is

VERY IMPORTANT MESSAGE:

In my case, the graphics cards supports OpenGL 4.1. According the readme.txt,

Please note carefully: EVEN IF YOU CAN BUILD THE SOURCES FOR YOUR FAVORITE PLATFORM OF CHOICE, YOU NEED RECENT OpenGL 4.x DRIVERS TO RUN THEM. PLEASE DON'T PAN THE BOOK BECAUSE YOUR COMPUTER DOESN'T SUPPORT OpenGL 4.x. THANKS

In my case, there was a problem with GLFW_OPENGL_CORE_PROFILE, therefore I needed to upgrade the graphics card driver. I've downloaded this software opengl extension viewer and it shows me the supported opengl version. My display adaptive is AMD Mobility Radeon HD 5000. I've visited their website and downloaded the latest driver for my display. Indeed, my graphics card now supports OpenGL 4.4 and this is a snapshot

You notice there is a button for Check for update Drivers. In my case, it directs me to a broken link, therefore, you need to go the website and check for the latest update for your display adaptive. Thank you.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!