Recently I got C++ source code from my friend regarding something I don’t know (yet). In that source there are #pragma comment macro which I didn’t familiar. So what is it?
According to Visual C++ documentation, #pragma comment is used to place a comment record into an object file or executable file. I think it means putting additional (user specified) information for linker. There are some specified type of this comment : compiler, exestr, lib, linker, user.
Source I received uses lib type to specify libs to link against. Actually I don’t really understand why someone specify it from source code, normally I will specify what libs to link from build system like cmake or msbuild project. I believe there are reasons behind this ( I just found about Auto-linking).