PDA

View Full Version : Reference to an unresolved external symbol On Visual Studio 2010,12 and CodeBlocks



QuesterDesura
10-18-2014, 08:23 AM
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 :(

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_COR E_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

BinaryFissionGames
10-18-2014, 12:55 PM
But then he told me Reference to an unresolved external symbol and I have no idea what I am doing wrong :(


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

QuesterDesura
10-18-2014, 03:30 PM
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

QuesterDesura
10-19-2014, 03:37 AM
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/%7C%7C%3D%3D%3D%20Build%3A%20Debug%20in%20Apocalyp seEngine%20(compiler%3A%20Microsoft%20Visual%20C%2 B%2B%202010)%20%3D%3D%3D%7C%0Amain.obj%7C%7Cerror% 20LNK2019%3A%20Verweis%20auf%20nicht%20aufgel%C3%B 6stes%20externes%20Symbol%20%22_glfwSwapBuffers%22 %20in%20Funktion%20%22_main%22.%7C%0Amain.obj%7C%7 Cerror%20LNK2019%3A%20Verweis%20auf%20nicht%20aufg el%C3%B6stes%20externes%20Symbol%20%22_glfwCreateW indow%22%20in%20Funktion%20%22_main%22.%7C%0Amain. obj%7C%7Cerror%20LNK2019%3A%20Verweis%20auf%20nich t%20aufgel%C3%B6stes%20externes%20Symbol%20%22_glf wWindowHint%22%20in%20Funktion%20%22_main%22.%7C%0 Amain.obj%7C%7Cerror%20LNK2019%3A%20Verweis%20auf% 20nicht%20aufgel%C3%B6stes%20externes%20Symbol%20% 22_glfwInit%22%20in%20Funktion%20%22_main%22.%7C%0 Abin%5CDebug%5CApocalypseEngine.exe%7C%7Cfatal%20e rror%20LNK1120%3A%204%20nicht%20aufgel%C3%B6ste%20 externe%20Verweise.%7C%0A%7C%7C%3D%3D%3D%20Build%2 0failed%3A%205%20error(s)%2C%200%20warning(s)%20(0 %20minute(s)%2C%200%20second(s))%20%3D%3D%3D%7C

QuesterDesura
10-20-2014, 01:15 AM
I guess everyone here has setup OpenGL up ;), so why can't anyone help me :O

Nikki_k
10-20-2014, 08:26 AM
It looks like you didn't add the library file for glfw as all missing symbols relate to that.

QuesterDesura
10-20-2014, 10:05 AM
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 ^^

BinaryFissionGames
10-20-2014, 06:47 PM
"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.

QuesterDesura
10-20-2014, 10:55 PM
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_COR E_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_COR E_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_COR E_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_COR E_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_COR E_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...

QuesterDesura
10-23-2014, 12:00 AM
Still same problem :/