I have had a hard time setting up OpenGL to work with Visual Studio 2010,but no luck so far.I included glut.h,gl.h.I have linked the requisite .lib files in the Project Properties,but still I get this error

error LNK2019: unresolved external symbol _glutMainLoop referenced in function _main

ind six more like it.Can anyone please explain the library linking part of the procedure.I searched over the Internet but came up with nothing.Still get those LNK2019 errors.

Dani AI

Generated

A short, practical follow-up: ’s fix (switching from an Empty Project to a Console project) is exactly the sort of setting problem that produces linker complaints, so credit to and for narrowing that down. For others who hit the same LNK2019 “unresolved external” messages when using GLUT/OpenGL, here’s a compact checklist and a few reliable troubleshooting steps.

  • Verify include/library paths are set for the active Configuration and Platform (Debug/Release and Win32/x64). If the project points at the wrong lib folder the linker will look but not find the symbol.
  • Make sure the GLUT import library and the OpenGL import libraries are listed under Linker → Input → Additional Dependencies for the same configuration.
  • Match architectures: 32-bit builds must use 32-bit GLUT/OpenGL libs; 64-bit builds need 64-bit libs. Mixing them produces unresolved externals.
  • Confirm the project SubSystem matches your entry point: if you use main set the SubSystem to Console (or create a Console app); a Win32 GUI project expects WinMain, which can cause confusion even when headers compile.

If the error persists: do a full clean/rebuild, enable verbose linker output to see which libraries are actually being searched, and use a tool like dumpbin or the freeglut sample binaries to confirm your import library exports the symbol you need. For modern Windows work consider switching to maintained alternatives such as freeglut or GLFW (they avoid some of the old GLUT packaging pitfalls).

References: freeglut project (downloads and examples) — https://freeglut.sourceforge.net/ ; Visual Studio linker input docs — .

Recommended Answers

All 2 Replies

Did you add glut32.lib to the list of libraries?

If it is not installed, follow these instructions.

Actually,I followed those instructions. But I had committed 1 error. I started off as an empty project. It should have been a console application.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.