GLFW and codeblocks

前端 未结 4 586
无人及你
无人及你 2020-12-10 08:16

I am having some difficulties with codeblocks 10.05 recognizing the GLFW libraries on my machine. When I create an empty project, and copy paste this code found from this GL

相关标签:
4条回答
  • 2020-12-10 08:37

    Follow the following procedure.

    1. First download the GLFW from here.
    2. unzip the zip file
    3. copy the glfw.h file from the include folder and paste to the folder "C:\Program Files\CodeBlocks\MinGW\include\GL"
    4. copy all file (libglfw.a and libglfwdll.a ) from the lib_mingw folder and paste to the folder "C:\Program Files\CodeBlocks\MinGW\lib"
    5. glfw.dll file from the lib_mingw folder of unzip file and paste it inside "C:\Windows\System32" floder. If you don't like to keep it in system32 then you can keep it with your project exe file.
    6. Now while creating the GLFW project in code::blocks give the path C:\Program Files\CodeBlocks\MinGW" for glfw location
    7. IF you are again confuse then go here for step by step procedure with image of every step.
    0 讨论(0)
  • 2020-12-10 08:51

    Follow these instrucions: http://codeincodeblock.blogspot.com/2011/02/setup-glfw-project-in-codeblock.html

    0 讨论(0)
  • 2020-12-10 08:53

    Make sure that you have the correct type of glfw libs. ie x86 or x64 for your mingw compiler. 8 Hours of time searching for undefined reference errors ie linker problems to glfw.

    0 讨论(0)
  • 2020-12-10 08:53

    I was having similar problems earlier with importing GLFW into codeblocks, and I recently found something that works for me.

    I can see that you have already done the header installation correctly, but I will include that in this response so that you can double-check that everything is in tip-top condition.

    I also recommend that you use the sample code within the 'Documentation' tab of glfw.org. It works really well for me, so I think it might for you as well.

    Since you are using GLFW, I will assume that you want to use OpenGL in your application, so I will include the installation of OpenGL in the tutorial


    A. Creating relevant folders

    The first thing you will need to do is set up a location for library files and header files on your system. You can either creates these folders within a specified location on your drive, or you can create these folders within your code::blocks project.

    In my case, I created a 'lib' and 'head' folder in my code::blocks project folder.


    B. Downloading & Installing necessary media

    GLFW:

    1. Head over to GLFW.org, and hit 'Downloads'.
    2. Click '32-bit Windows binaries', and open the 'glfw-version.bin.WIN32' within zip file that was downloaded.
    3. Open the 'include' folder and copy the enclosed GLFW folder to the 'head' folder you created in part A.
    4. Open up 'glfw-version.bin.WIN32' again, and pick the 'lib' folder that corresponds to your compiler. Because I am using the MinGW GCC compiler, I picked 'lib-mingw'. To find your compiler, go to code::blocks, click settings, and then click 'compiler...'. Your compiler is found in the 'selected compiler' section of the window that appears.
    5. Once you've found the 'lib' folder that you will use, open it, and copy all of the files within into the 'lib' folder that you created during part A.

    GLEW (OpenGL):

    1. Go to this link
    2. Open the folder that is within the downloaded zip.
    3. Go to 'lib', then release, then Win32, and copy all of the files located there into the 'lib' folder you created in step A.
    4. Go back to the folder within the downloaded zip.
    5. Enter the 'include' directory, and copy the 'GL' folder into the 'head' folder created in part a.

    At this point, your 'head' folder should contain 'GLFW' and 'GL' folders, and your 'lib' folder should contain 'glew32', 'glew32s', and all of the library files from GLFW for your compiler.


    C. Configuring your code::blocks project

    1. Once you've opened your project, right click on the name of your project in your workspace, and hit 'build options...
    2. On the left of the window that has appeared, make sure 'Debug' is selected.
    3. Next click the 'linker settings' tab, and add the following libraries: 'glfw.3', 'gdi32', and 'opengl32'.
    4. Next, in the 'Search Directories' tab, select the 'Compiler' tab.
    5. Add the path to your 'head' folder. If the head folder was created within your project folder, you can just type 'head'
    6. Also in the 'Search Directories' tab, select the 'Linker' tab.
    7. Add the path to your 'lib' folder. Again, if the lib folder was created withing your project folder, you can just type 'lib'.
    8. Hit 'OK' at the bottom of the window.

    D. Build and Run your code :)! Hope this helps!

    0 讨论(0)
提交回复
热议问题