Why is Visual Studio Trying to Link 'freeglutd.lib'?

微笑、不失礼 提交于 2019-12-04 04:52:01

if you check the freeglut_std.h (freeglut V3.0):

            /* Link with Win32 shared freeglut lib */
#           if FREEGLUT_LIB_PRAGMAS
#               ifdef NDEBUG
#                   pragma comment (lib, "freeglut.lib")
#               else
#                   pragma comment (lib, "freeglutd.lib")
#               endif
#           endif

so if you don't define NDEBUG, the linker will link to "freeglutd.lib", you can solve that by defining a NDEBUG in "PreprocessorDefinitions". Good luck!

rbaleksandar

Possibly already answered: freeglut error LNK1104

Also two things to check for:

  • Are you building in debug or release mode? The d at the end of freeglutd.lib suggests that it's a library meant for debug builds
  • Try creating a new project from scratch, put some basic runnable code in it that uses freeGLUT and see if VS is linking properly. This will also verify if for some reason the project file of the previous project was corrupted (as @RobertHarvey suggested) or the problem is somewhere else

I solved this problem by compiling freeglut and freeglut_static from generated CMake soluton in Debug mode - freeglutd was created in the lib/Debug directory. You can put this directory into lib path then and it will work!

Hey man I don't know if you're still having this error but here is a solution. Pretty much the "freeglutd.lib" has to do with debugging, hence the "d" on the end, so what I did was go into the:

Properties > C/C++ > Preprocessor > Preprocessor Definitions and type NDEBUG. Then OK and Apply.

What this does is in the "freeglut_std.h" there is a ifdef for NDEBUG that if it is defined then use "freeglut.lib" otherwise it's going to use the "freeglutd.lib". So by defining it in the Preprocessor Definitions, you are now using the "freeglut.lib". Hopefully this helps you out!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!