4

Tried getting GLFW to work so that I can start on my project. I'm currently using code from the GLFW site, nothing has been added to that code. I have the path of the lib file coming from C:\Users\herrigdy\Desktop\Visual Studio 2017\BB\Dependencies\include\GLFW and I'm using the $(SolutionDir) macro. That's for the header files.

Then I have glfw3.lib linked in the additional dependencies. Looking at the code nothing is immediately wrong, but it still comes up with this error.

I've tried shortening the path for the header files and have followed the third party library part of the msdn site.

I have the 32-bit binaries for GLFW and I'm building for x86.

The only thing I haven't tried from this site was that the library may have needed other files, but the video I watched to help me set this up didn't reference any other third party dependencies for GLFW.

They also said that we wouldn't need the glfw3.dll or glfw3lib.dll (not entirely sure if those are the exact files off the top of my head).

I've also tried copying the evaluated value from the additional dependencies, but it keeps saying that access to said file was disallowed.

I'm working from my school computer so there may be some sort of block that isn't allowing visual to read those files. I can provide screenshots of code if needed.

Edit: Here's code for reference, should also add that the error list says the error is in line 1 file LINK

#include <iostream>
using namespace std;
#include "GLFW/glfw3.h"

int main(void)
{
    GLFWwindow* window;

    /* Initialize the library */
    if (!glfwInit())
        return -1;

    /* Create a windowed mode window and its OpenGL context */
    window = glfwCreateWindow(640, 480, "Hello World", NULL, NULL);
    if (!window)
    {
        glfwTerminate();
        return -1;
    }

    /* Make the window's context current */
    glfwMakeContextCurrent(window);

    /* Loop until the user closes the window */
    while (!glfwWindowShouldClose(window))
    {
        /* Render here */
        glClear(GL_COLOR_BUFFER_BIT);

        /* Swap front and back buffers */
        glfwSwapBuffers(window);

        /* Poll for and process events */
        glfwPollEvents();
    }

    glfwTerminate();
    return 0;
}
DRHerrig
  • 49
  • 1
  • 3
  • 1
    hi and welcome to Stack Overflow, please post the code you have written so far and have a look at this guide https://stackoverflow.com/help/minimal-reproducible-example – Yvonne Aburrow Oct 22 '19 at 16:34
  • [Here](https://stackoverflow.com/questions/133698/why-does-fatal-error-lnk1104-cannot-open-file-c-program-obj-occur-when-i-c) is a list of possible causes. Also, be sure you don't mix 32/64 bits glfw/yourapp versions. – Ripi2 Oct 22 '19 at 19:36
  • Checked to see if some of these would work and they didn't. I'm not 100% sure if my version of Visual Studio is 32 or 64 bits, but I'm using the 32 bit binaries from GLFW and building to x86. I've just assumed that the tech people would have installed the 64 bit version of VS – DRHerrig Oct 23 '19 at 15:24
  • I've also tried setting up GLFW on my computer at home and it comes up with the same error. – DRHerrig Oct 24 '19 at 15:11

2 Answers2

4

i think you haven't included the lib folder

go to property then linker in general additional library directories and choose lib folder

alabdaly891
  • 159
  • 1
  • 8
  • 1
    do you mind if i make you a project base to start with ? – alabdaly891 Oct 22 '19 at 19:49
  • I wouldn't mind. Haven't worked with GLFW for a while and initial setup always tripped me up. – Koenigsberg Oct 22 '19 at 22:22
  • Yeah a project base would be nice. Later today I'm going to see if it's just my computer not allowing VS to access and read the files. Our school probably has some sort of block that may cause that. – DRHerrig Oct 23 '19 at 15:26
0

I realized that I actually had deleted the additional library directories linking code. I also forgot to link to the opengl32.lib folder.

DRHerrig
  • 49
  • 1
  • 3