0

I have followed these tutorials to learn OpenGL: http://www.opengl-tutorial.org/

In the tutorials we learn how to compile the exercises using cmake, but we never learn how to set it up ourselves. Now I want to start a project from scratch, after trying multiple times I still fail.

I make sure I have an external folder with the following files: GLEW_190.lib, glfw3.lib. And the following include directories: glew-1.9.0, glfw-3.0.3, glm-0.9.4.0

This should be enough as I was able to minimize the project from cmake to this structure, and it compiles completely standalone.

The problem lies in the visual studio project itself. I include all the correct include folders and setup the correct additional libs. The project compiles but doesn't link. I get the following error:

shader.obj : error LNK2001: unresolved external symbol ___glewDeleteShader

About 10 other times with different symbols. My additional libs:

glu32.lib
opengl32.lib
external\glfw3.lib
external\GLEW_190.lib

This should be correct although it doesn't want to work. I have a project that uses OpenGL on Github. I basically had to strip down the big project into a very simple one and added my code to that. I don't want to be doing all that work each time.

Github project for reference: https://github.com/DiedeApers/Chip8Emulator

genpfault
  • 51,148
  • 11
  • 85
  • 139
user1091566
  • 121
  • 2
  • 10
  • 3
    Ah, "OpenGL from scratch"... I was hoping to find an alternative OpenGL implementation in this thread. So disappointed :( – Ivan Aksamentov - Drop Nov 05 '14 at 01:07
  • BTW, I've cloned your git repo and this project builds and works just fine in VS2013. At least Debug | x64 config. – Ivan Aksamentov - Drop Nov 05 '14 at 01:10
  • I have read the post about the unresolved external symbol error, but I don't see how this helps me. I've added the lib folder to the additional dependencies and added the .libs, how can I still get this error? I use the same setup as the project that is able to compile standalone. – user1091566 Nov 05 '14 at 15:24
  • So, are your project is what we got on github? (it builds just fine) Or is this original one? If latter let us see your project. – Ivan Aksamentov - Drop Nov 05 '14 at 17:21
  • Here is a link to the project that doesn't want to link: https://mega.co.nz/#!nQphGaAK!nyoYacyjsfSyFPdC1nMs8cO_wxgNpVCwzKBtjQ3g-zM – user1091566 Nov 05 '14 at 21:57
  • The problem is that you are trying to link to your `Win32` (`x86`) project with the libraries from `Chip8Emulator` which are for `x64` architecture. The solution is to download/build libs matching your config or (which isn't that right) to make your config match the lib's config. Quick Googling of libz names will retrieve their official websites. Consider also using relative paths in the project settings: with absolute paths you have now, neither I was unable to open the project, nor you will be able to do this if you move a folder with it it one day. – Ivan Aksamentov - Drop Nov 06 '14 at 02:07
  • You can quickly inspect all the settings if you open project file (`.vcxproj`) with text editor. Be aware also of the fact, that latest release version of Visual studio is `2013`. Visual Studio 2014 coming soon. Express versions are available for free. So there is no need to use 5 years old IDE and compiler. – Ivan Aksamentov - Drop Nov 06 '14 at 02:09
  • Wow! I had not thought about that. Thank you very much, I think I can resolve my problem now. The old IDE is because of OptiX, it should work with VS2012 but I quickly ran into problems and was suggested to go with 2010. Thanks again! – user1091566 Nov 06 '14 at 10:48

0 Answers0