GLFW Across multiple files
-
Hey there guys, Okay I have my current code working for GLFW. Effectively i'm just trying to build a small main-frame which I can build on. I have IniApi.cc that stores the
main()
routine. I have CharKeyCallback.cc which handles theglfwSetCharCallback()
just fine. However, i'm trying to make aTexture
class which will load textures from a file and store them in memory. So, I placed this at the top of theTexture.cc
file:#include <Windows.h>
#include <GL/glfw.h>
#include <stdio.h>#include "Texture.h"
And my "load" function works like this:
bool Texture::ReadImage()
{
glfwReadImage(_filename, ImageData, _flags);
return !(ImageData == NULL);
}(If it appears messy or simple, it's because i'm just laying the foundations at the moment). However, when I go to compile, I receive the following error:
error LNK2019: unresolved external symbol _glfwReadImage referenced in function "public: bool __thiscall Texture::ReadImage(void)" (?ReadImage@Texture@@QAE_NXZ)
Now, my
InitApi.cc
runs the lpfw functions just fine, which means the library & DLL have been loaded (glfwOpenWindow
opens a window successfully) butTexture.cc
won't recognise the lpfw functions, even though i've included#include <GL/glfw.h>
at the top. Any suggestions? Thank you :) -
Hey there guys, Okay I have my current code working for GLFW. Effectively i'm just trying to build a small main-frame which I can build on. I have IniApi.cc that stores the
main()
routine. I have CharKeyCallback.cc which handles theglfwSetCharCallback()
just fine. However, i'm trying to make aTexture
class which will load textures from a file and store them in memory. So, I placed this at the top of theTexture.cc
file:#include <Windows.h>
#include <GL/glfw.h>
#include <stdio.h>#include "Texture.h"
And my "load" function works like this:
bool Texture::ReadImage()
{
glfwReadImage(_filename, ImageData, _flags);
return !(ImageData == NULL);
}(If it appears messy or simple, it's because i'm just laying the foundations at the moment). However, when I go to compile, I receive the following error:
error LNK2019: unresolved external symbol _glfwReadImage referenced in function "public: bool __thiscall Texture::ReadImage(void)" (?ReadImage@Texture@@QAE_NXZ)
Now, my
InitApi.cc
runs the lpfw functions just fine, which means the library & DLL have been loaded (glfwOpenWindow
opens a window successfully) butTexture.cc
won't recognise the lpfw functions, even though i've included#include <GL/glfw.h>
at the top. Any suggestions? Thank you :)Nevermind. For those who might encounter this problem, it turns out I had to add
#define GLFW_DLL
before the#include <GL/glfw.h>
Resolved.