What is #pragma comment (lib, "lib / glut32.lib")?

I saw the code at the top of the GLUT demo, and I'm curious about its functionality.

Why does someone want to write #pragma instead of just including the library?

+3
source share
3 answers

This pragma allows the library author to determine the import of libraries based on a number of criteria that can be analyzed at compile time. For example, you can link to different libraries based on whether you want to link to:

  • multithreading on / off
  • general or static version of the library in question;
  • General or static version of the standard runtime library
  • ;
  • 32- 64- .

#ifdef .

+3

#pragma , . , .lib (, debug vs. release, C- DLL ..). #ifdef , .lib , , .

, .lib .

+1

MSVC , , . " " , : (GL/glut.h) , . (lib/glut32.lib) .

, , , ( ). (, @martin clayton) , .

+1
source

Source: https://habr.com/ru/post/1767802/


All Articles