What does “#pragma comment” mean?

后端 未结 5 1181
孤城傲影
孤城傲影 2020-11-28 18:03

What does #pragma comment mean in the following?

#pragma comment(lib, \"kernel32\")
#pragma comment(lib, \"user32\")
5条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-28 18:41

    I've always called them "compiler directives." They direct the compiler to do things, branching, including libs like shown above, disabling specific errors etc., during the compilation phase.

    Compiler companies usually create their own extensions to facilitate their features. For example, (I believe) Microsoft started the "#pragma once" deal and it was only in MS products, now I'm not so sure.

    Pragma Directives It includes "#pragma comment" in the table you'll see.

    HTH

    I suspect GCC, for example, has their own set of #pragma's.

提交回复
热议问题