Reference to an unresolved external symbol On Visual Studio 2010,12 and CodeBlocks

Hello,

I tried many times to setup modern opengl but every time I failed.
Today I tried it again… and failed again…

My first Attempt was with SDL, Glew, GLM and Visual Studio 2012 C++.
First of all I had Problems with iostream in Visual Studio 2012 so I changed it to 2010 and it worked…

Then I had problems with SDL and after editing plattforms.h where he had problems with winapifamily it worked too

But then he told me Reference to an unresolved external symbol and I have no idea what I am doing wrong :frowning:

Then I tried it on CodeBlocks with GLFW and Glew and I am Getting the Same Error

This is my code on CodeBlocks:

#define GLEW_NO_GLU
#define GLFW_NO_GLU
#define GLFW_EXPOSE_NATIVE_WIN32
#define GLFW_EXPOSE_NATIVE_WGL
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <GLFW/glfw3native.h>
int main() {

glfwInit();
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR,3);
glfwWindowHint(GLFW_OPENGL_PROFILE,GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT,GL_TRUE);

GLFWwindow* myWindow = glfwCreateWindow(800,600,"Apocalypse Engine",NULL,NULL);

while(true)
{
    glfwSwapBuffers(myWindow);

}

}

My Folder hierarchy:

  • Apocalypse Engine:
    • bin
    • obj
    • main.cpp and some codeblocks stuff
    • include:
      GL…
      GLFW…
    • lib:
      • glew32.lib
      • glew32s.lib
      • glfw3.lib
      • glfw3.lib
      • glfw3dll.lib
      • OpenGL32.Lib (from the Folder Window Kits I have taken It)

Compiler: Visual Studio 2010
Linker settings:
- lib\glew32.lib
- lib\glew32s.lib
- lib\glfw3.lib
- lib\glfw3.lib
- lib\glfw3dll.lib
- lib\OpenGL32.Lib
- opengl32.lib (yea i thinked that would be the problems so I added this but still not working :-()
Search Directories-Compiler:
- include
Search Directories-Linker:
- lib

I have no idea what I am doing wrong but It would be awesome if you can help me, because I am trying this since a year(with interruptions of course ;))

(I already programmed with old OpenGL but I got it installed on other PC and I dont have access to that pc and I want modern OpenGL)

Hopefully Waiting for Response

QuesterDesura

PS: 1. I am native German I hope you can understood what I wrote
2. It is Console Application

What symbol was it? This could help identify what library is having the problem. Please provide the error log.

Currently I dont have access to the logs, but tomorrow(today) I have

I know only that on my CodeBlocks Attempt I got this error(unresolved external…) for all GLFW functions called(WindowHint,CreateWindow…)

I think the problem is that I domt have implementend opengl32.lib correctly but I dont kbow what I could make wrong and if my thoughts are correct but anyways thanks for your time, I will post the error today here

I made serveral Screenshots from my Settings, my Code and the Error and uploaded it in this Folder: www.eigenespcspielselbererstellen.de/images/CodeBlocks/

And because the Error is particularly in German: https://translate.google.de/#de/en/||%3D%3D%3D%20Build%3A%20Debug%20in%20ApocalypseEngine%20(compiler%3A%20Microsoft%20Visual%20C%2B%2B%202010)%20%3D%3D%3D| main.obj||error%20LNK2019%3A%20Verweis%20auf%20nicht%20aufgelöstes%20externes%20Symbol%20"_glfwSwapBuffers"%20in%20Funktion%20"_main".| main.obj||error%20LNK2019%3A%20Verweis%20auf%20nicht%20aufgelöstes%20externes%20Symbol%20"_glfwCreateWindow"%20in%20Funktion%20"_main".| main.obj||error%20LNK2019%3A%20Verweis%20auf%20nicht%20aufgelöstes%20externes%20Symbol%20"_glfwWindowHint"%20in%20Funktion%20"_main".| main.obj||error%20LNK2019%3A%20Verweis%20auf%20nicht%20aufgelöstes%20externes%20Symbol%20"_glfwInit"%20in%20Funktion%20"_main".| bin\Debug\ApocalypseEngine.exe||fatal%20error%20LNK1120%3A%204%20nicht%20aufgelöste%20externe%20Verweise.| ||%3D%3D%3D%20Build%20failed%3A%205%20error(s)%2C%200%20warning(s)%20(0%20minute(s)%2C%200%20second(s))%20%3D%3D%3D%7C

I guess everyone here has setup OpenGL up ;), so why can’t anyone help me :open_mouth:

It looks like you didn’t add the library file for glfw as all missing symbols relate to that.

I have implemented glfw3.lib as it is told on their webseite and you can see that on this image: http://www.eigenespcspielselbererstellen.de/images/CodeBlocks/CodeBlocksLinker.png
But maybe I done something wrong I don’t know it thats why I am asking ^^

“The link library for the GLFW DLL is named glfw3dll. When compiling a program that uses the DLL version of GLFW, you need to define the GLFW_DLL macro before any inclusion of the GLFW header. This can be done either with a compiler switch or by defining it in your source code.”

Did you do that? You seem to be including the DLL version.

Have you looked through this page? http://www.glfw.org/docs/latest/build.html

It’s certainly a GLFW3 problem.

Still same problem and here is my new Code(bold is new);
#define GLEW_NO_GLU
#define GLFW_NO_GLU
#define GLFW_EXPOSE_NATIVE_WIN32
#define GLFW_EXPOSE_NATIVE_WGL
#define GLFW_DLL
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <GLFW/glfw3native.h>
int main() {

glfwInit();
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR,3);
glfwWindowHint(GLFW_OPENGL_PROFILE,GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT,GL_TRUE);

GLFWwindow* myWindow = glfwCreateWindow(800,600,"Apocalypse Engine",NULL,NULL);

while(true)
{
    glfwSwapBuffers(myWindow);

}

}
I have #define GLEW_NO_GLU
#define GLFW_NO_GLU
#define GLFW_EXPOSE_NATIVE_WIN32
#define GLFW_EXPOSE_NATIVE_WGL
#define GLFW_DLL
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <GLFW/glfw3native.h>
int main() {

glfwInit();
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR,3);
glfwWindowHint(GLFW_OPENGL_PROFILE,GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT,GL_TRUE);

GLFWwindow* myWindow = glfwCreateWindow(800,600,"Apocalypse Engine",NULL,NULL);

while(true)
{
    glfwSwapBuffers(myWindow);

}

}
I #define GLEW_NO_GLU
#define GLFW_NO_GLU
#define GLFW_EXPOSE_NATIVE_WIN32
#define GLFW_EXPOSE_NATIVE_WGL
#define GLFW_DLL
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <GLFW/glfw3native.h>
int main() {

glfwInit();
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR,3);
glfwWindowHint(GLFW_OPENGL_PROFILE,GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT,GL_TRUE);

GLFWwindow* myWindow = glfwCreateWindow(800,600,"Apocalypse Engine",NULL,NULL);

while(true)
{
    glfwSwapBuffers(myWindow);

}

}
#define GLEW_NO_GLU
#define GLFW_NO_GLU
#define GLFW_EXPOSE_NATIVE_WIN32
#define GLFW_EXPOSE_NATIVE_WGL
#define GLFW_DLL
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <GLFW/glfw3native.h>
int main() {

glfwInit();
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR,3);
glfwWindowHint(GLFW_OPENGL_PROFILE,GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT,GL_TRUE);

GLFWwindow* myWindow = glfwCreateWindow(800,600,"Apocalypse Engine",NULL,NULL);

while(true)
{
    glfwSwapBuffers(myWindow);

}

}#define GLEW_NO_GLU
#define GLFW_NO_GLU
#define GLFW_EXPOSE_NATIVE_WIN32
#define GLFW_EXPOSE_NATIVE_WGL
#define GLFW_DLL
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <GLFW/glfw3native.h>
int main() {

glfwInit();
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR,3);
glfwWindowHint(GLFW_OPENGL_PROFILE,GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT,GL_TRUE);

GLFWwindow* myWindow = glfwCreateWindow(800,600,"Apocalypse Engine",NULL,NULL);

while(true)
{
    glfwSwapBuffers(myWindow);

}

}
I have glfw3.dll in my Debug Folder and in my lib folder
And as you can see I in the images I have linked glfw3.lib and glfw3dll.lib…

Still same problem :confused: