简体   繁体   中英

What exactly happen when we reference a library as additional dependency in a C++ project using VS?

when we want to use a static library (*.lib) file we reference it in project properties in additional library dependencies portion, what i do want to know is how exactly VS handle this linkage? in other words is there any alternative way to this VS task -linking a library in link step- by piece of code or anything else?

You can use

#pragma comment(lib, "<library path and name>")

Then you don´t need to add your library into project settings

To figure out what Visual Studio has done, add the reference. Now, using your source control/favorite diff tool, compare the old .vcxproj file to the new one. You should see what changes were made to the .vcxproj, which is the file used to drive the build.

I assume that you are using source control and the .vcxproj is under source control. If not, make a copy of the original .vcxproj somewhere to compare with. (Also, strongly consider using source control. :-] )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM