Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pragma comment C++

When I am using a non-standard library in C++ I have to add the library name in linker-->input-->additional dependencies . But the alternative is to write

#pragma comment(lib , "library name")

Are these two methods completely the same?

like image 828
Sam379 Avatar asked Jun 21 '13 21:06

Sam379


1 Answers

They are not.

The said pragma adds a defaultlib. The option a mandatory lib to the linker line.

The latter is processed no matter what, and you get error if it is missing. The default lib is ignored silently if not found. And using options "ignore default libs" or "ignore specific default lib" can be used to dismiss its use even if it is present.

like image 93
Balog Pal Avatar answered Sep 19 '22 22:09

Balog Pal