What does “#pragma comment” mean?

后端 未结 5 1190
孤城傲影
孤城傲影 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:34

    #pragma comment is a compiler directive which indicates Visual C++ to leave a comment in the generated object file. The comment can then be read by the linker when it processes object files.

    #pragma comment(lib, libname) tells the linker to add the 'libname' library to the list of library dependencies, as if you had added it in the project properties at Linker->Input->Additional dependencies

    See #pragma comment on MSDN

提交回复
热议问题