LNK2019 glewInit

后端 未结 2 1921
一向
一向 2021-01-28 22:23

I have glew version 1.9.0 I have put all the header files in the MSVS include directory and all the lib files in the lib folder. I then put the dll within the sysWOW64 folder a

相关标签:
2条回答
  • 2021-01-28 22:33

    First, you should not place your DLLs into sysWOW64 or any other Operating System owned directory such as System32. That said, this has nothing to do with where you placed your DLLs and everything to do with the library you linked to (or rather did not link to).

    You also should not be linking to 4 different GLEW configurations:

    1. Dynamic (glew32)
    2. Dynamic multi-context (glew32mx)
    3. Static (glew32s)
    4. Static multi-context (glew32mxs)

    The best library to link to usually is glew32s.lib as it negates the need for the DLL in the first place, but then you need to add #define GLEW_STATIC before you #include "glew.h"

    In MSVC you can add the following to a source file to take care of all of these things at once:

    #pragma comment (lib, "glew32s.lib")
    #define GLEW_STATIC
    #include "glew.h"
    
    0 讨论(0)
  • 2021-01-28 22:39

    I found the solution to this problem here:

    • Include Header files:

      1. Right click on your project > Properties > Configuration > C/C++ > General > Additional Include Directories
      2. On the right dropdown, click <Edit...>
      3. Additional Inclue Directories has appeared
      4. Click the new line icon > browse button then select the glew include folder: $(your path to glew)\glew-1.12.0\include
    • Include Libraries

      1. Right click on your project > Properties > Configuratio Properties > Linker > General > Additional Library Directories
      2. Click <Edit...>
      3. Additional Library Directories has appeared
      4. For the 64-bit version: add $(your path to glew)\glew-1.12.0\lib\Release\x64
      5. For 32-bit version: add $(your path to glew)\glew-1.12.0\lib\Release\Win32
      6. Right click on your project (again) >Properties > Configuration Properties > Linker > Input > Additional Dependencies
      7. Click <Edit..>
      8. Additional Dependencies window has appeared
      9. Click the white area and write glew32.lib

    (Side Note: The accepted answer did NOT solve the problem)

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