The comment can then be read by the linker when it processes object files. #pragmacomment(lib, libname) tells the linker to add the 'libname' library to the...
Here are a couple of examples: Linking with a Library ... This specifies the entry point for the executable. Linking with DLL: #pragmacomment(lib, "mydll.lib").
#pragmacomment(lib, "DLL1.lib"). has the same effect (as an alternative approach) of set DLL1.lib as implicit link library input in project link settings?
Go Up to Pragma Directives Overview Index. #pragmacomment({lib | exestr | user} [ , "STR" ["STR" ...] ]). The comment directive lets you write a comment record into...
Visual C++ Programming. What does #pragmacomment(lib,"wsock32.lib") make? If this is your first visit, be sure to check out the FAQ by clicking the link above.
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 microsoft.com
19 Ocak 2023
225 kişi değerlendirdi
2 yorum
{"2_ck02":{"state":{"logo":{"href":"//yandex.com.tr","isForeign":true},"form":{"action":"/search/","searchLabel":"Bul","hiddenInputs":[{"name":"lr","value":20815}]},"actions":{"advancedSearch":{"checked":false,"ariaLabel":"Gelişmiş arama"},"moreButtonProps":{"ariaLabel":"Daha fazla"},"cbir":{"name":"cbir","label":"Görsele göre arama","infoUrl":"//yandex.ru/promo/photosearch/index?source=landingdesk","isMacOS":false}},"userSection":{"loggedIn":false,"loginProps":{"loginUrl":"https://passport.yandex.com.tr/auth?retpath=%2F&origin=serp_desktop_auth_new","loginText":"Giriş yap","burgerAriaLabel":"Menü"}},"navigation":{"tabs":[{"id":"www","label":"Arama","url":"//yandex.com.tr","params":{"source":"tabbar"},"target":""},{"id":"images","label":"Görsel","url":"//yandex.com.tr/gorsel/search","params":{"text":"[$query]","noreask":"[$noreask]","nomisspell":"[$nomisspell]","parent-reqid":"[$reqid]","from":"tabbar"}},{"id":"video","label":"Video","url":"//yandex.com.tr/video/search","params":{"text":"[$query]","noreask":"[$noreask]","parent-reqid":"[$reqid]","from":"tabbar"}},{"id":"maps","label":"Haritalar","url":"//yandex.com.tr/harita","params":{"text":"[$query]","source":"serp_navig"}},{"id":"translate","label":"Çeviri","url":"//ceviri.yandex.com.tr","params":{"text":"[$query]","from":"tabbar"}}],"selectedTabId":"www"},"context":{"query":"pragma comment lib","reqid":"1726515912769766-12286305286587705883-balancer-l7leveler-kubr-yp-sas-228-BAL","lr":"20815","counters":{"type":"b","data":{"$header":"0_b933z000","logo":"0_b933z001","login":"0_b933z003","usermenu":"0_b933z004","market-cart":"0_b933z006","more-button":"0_b933z007","cbir":"0_b933z008","$navigation":"0_b933z009","item":"0_b933z00i","tab-www":"0_b933z00b","tab-images":"0_b933z00d","tab-video":"0_b933z00f","tab-maps":"0_b933z00h","tab-translate":"0_b933z00j"}}},"loggedIn":false,"baobab":{"parentNode":{"context":{"genInfo":{"prefix":"0_b933w01-0-1"},"ui":"desktop","service":"web","reqid":"1726515912769766-12286305286587705883-balancer-l7leveler-kubr-yp-sas-228-BAL","fast":{"name":"header-desktop"}}}}},"type":"header-desktop"},"2_b9330":{"state":{"advAjax":{"subtype":"premium_ajax","shown":"eyJwcmVtaXVtIjpbXX0="},"baobab":{"parentNode":{"context":{"genInfo":{"prefix":"2_b933w0a-0-1"},"ui":"desktop","service":"web","reqid":"1726515912769766-12286305286587705883-balancer-l7leveler-kubr-yp-sas-228-BAL","fast":{"name":"adv","subtype":"return_ajax"}}}}},"type":"adv","subtype":"return_ajax"},"2_b9331":{"state":{"answersUrl":"https://stackoverflow.com/questions/3484434/what-does-pragma-comment-mean#answers","type":"fact","tabsOptions":[{"id":"question","text":"Soru"},{"id":"bestAnswer","text":"En iyi yanıt"},{"id":"moreAnswers","text":"4 yanıt daha","shortText":"Daha fazla"}],"tabContents":{"question":{"construct":[{"type":"paragraph","content":[{"type":"text","content":"What does "},{"type":"code","content":[{"type":"text","content":"#pragma comment"}],"isInline":true},{"type":"text","content":" mean in the following?"}]},{"type":"code","content":[{"type":"text","content":[{"type":"text","color":"comment","content":"#pragma comment(lib, \"kernel32\")"}]},{"type":"text","content":[{"type":"text","color":"comment","content":"#pragma comment(lib, \"user32\")"}]}]}],"footerProps":{"date":1530107830,"numLiked":198,"numCommented":0}},"bestAnswer":{"construct":[{"type":"paragraph","content":[{"type":"code","content":[{"type":"text","content":"#pragma comment"}],"isInline":true},{"type":"text","content":" 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."}]},{"type":"paragraph","content":[{"type":"code","content":[{"type":"text","content":"#pragma comment(lib, libname)"}],"isInline":true},{"type":"text","content":" 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 "},{"type":"code","content":[{"type":"text","content":"Linker->Input->Additional dependencies"}],"isInline":true}]},{"type":"paragraph","content":[{"type":"text","content":"See "},{"type":"text","content":"#pragma comment"},{"type":"text","content":" on microsoft.com"}]}],"footerProps":{"date":1674153901,"numLiked":225,"numCommented":2}},"moreAnswers":[{"construct":[{"type":"paragraph","content":[{"type":"text","content":"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."}]},{"type":"paragraph","content":[{"type":"text","content":"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."}]},{"type":"paragraph","content":[{"type":"text","content":"Pragma Directives"},{"type":"text","content":" It includes \"#pragma comment\" in the table you'll see."}]},{"type":"paragraph","content":[{"type":"text","content":"HTH"}]},{"type":"paragraph","content":[{"type":"text","content":"I suspect GCC, for example, has their own set of #pragma's."}]}],"footerProps":{"date":1531791602,"numLiked":7,"numCommented":5}},{"construct":[{"type":"paragraph","content":[{"type":"text","content":"The answers and the documentation provided by MSDN is the best, but I would like to add one typical case that I use a lot which requires the use of "},{"type":"code","content":[{"type":"text","content":"#pragma comment"}],"isInline":true},{"type":"text","content":" to send a command to the linker at link time for example "}]},{"type":"code","content":[{"type":"text","content":[{"type":"text","color":"comment","content":"#pragma comment(linker,\"/ENTRY:Entry\")"}]}]},{"type":"paragraph","content":[{"type":"text","content":"tell the linker to change the entry point form "},{"type":"code","content":[{"type":"text","content":"WinMain()"}],"isInline":true},{"type":"text","content":" to "},{"type":"code","content":[{"type":"text","content":"Entry()"}],"isInline":true},{"type":"text","content":" after that the "},{"type":"code","content":[{"type":"text","content":"CRTStartup"}],"isInline":true},{"type":"text","content":" going to transfer controll to "},{"type":"code","content":[{"type":"text","content":"Entry()"}],"isInline":true}]}],"footerProps":{"date":1567519911,"numLiked":4,"numCommented":0}}]},"organic":{"faviconProps":{"src":"https://favicon.yandex.net/favicon/v2/https://stackoverflow.com","size":"m","pageNumber":0,"index":0},"title":"What does \"#\u0007[pragma\u0007] \u0007[comment\u0007]\" mean?","pathProps":{"items":[{"url":"https://stackoverflow.com/questions/3484434/what-does-pragma-comment-mean","text":"stackoverflow.com"},{"url":"https://stackoverflow.com/questions/3484434/what-does-pragma-comment-mean","text":"what-does-pragma-comment-mean"}]},"faviconPosition":0,"subtitlePosition":1,"linkProps":{"url":"https://stackoverflow.com/questions/3484434/what-does-pragma-comment-mean"},"hostTitle":"Stackoverflow.com","description":"stackoverflow.com › what-does-pragma-comment-mean"},"extralinksProps":{"hidden":true,"directions":["bottom-end"],"items":[{"variant":"reportFeedback","reportFeedback":{"feature":"Блок ответов для разработчиков","title":"Bu yanıtta yanlış olan nedir?","checkBoxLabels":[{"value":"Yanıt sorguya uygun değil"},{"value":"Yanıt hatalı"},{"value":"Yanıttaki bilgiler eksik"},{"value":"Diğer"}]}}]},"baobab":{"parentNode":{"context":{"genInfo":{"prefix":"2_b933w0c-0-1"},"ui":"desktop","service":"web","reqid":"1726515912769766-12286305286587705883-balancer-l7leveler-kubr-yp-sas-228-BAL","fast":{"name":"article"}}}}},"type":"article"},"2_b9332":{"state":{"linksGroups":[{"type":"geo","links":[{"label":"Columbus","title":"Columbus","url":"//yandex.com.tr/tune/geo","logNode":{"name":"region"},"target":"_self","a11yLabel":"Bölgeniz Columbus","needRetpath":true}]},{"type":"feedback","links":[{"label":"Hata bildir","logNode":{"name":"feedback","attrs":{"behaviour":{"type":"dynamic"}}}}]},{"type":"settings","links":[{"label":"Ayarlar","url":"//yandex.com.tr/tune/search","logNode":{"name":"settings"},"target":"_self","needRetpath":true}]},{"type":"company","links":[{"label":"Hakkımızda","url":"https://company.yandex.com.tr","logNode":{"name":"about"},"target":"_blank"},{"label":"Ticari teklifler","url":"/search/direct?text=pragma%20comment%20lib&filters_docs=direct_cm","logNode":{"name":"commercial"},"target":"_blank"},{"label":"Kariyer","url":"//yandex.com.tr/jobs/?utm_source=serp_turkie&utm_medium=footerlink&utm_content=career","logNode":{"name":"vacancy"},"target":"_blank"},{"label":"Kullanım lisansı","url":"//yandex.com.tr/legal/termsofuse/","logNode":{"name":"license"},"target":"_blank"},{"label":"Gizlilik Politikası","url":"//yandex.com.tr/legal/confidential/","logNode":{"name":"confidential"},"target":"_blank"}],"a11yHidden":true}],"reportFeedbackProps":{"feature":"Подвал","title":"Hata bildir","checkBoxLabels":[]},"isSearchApp":false,"hasExtralinks":true,"limitingSelector":".AliceFabButton","baobab":{"parentNode":{"context":{"genInfo":{"prefix":"2_b933w0d-0-1"},"ui":"desktop","service":"web","reqid":"1726515912769766-12286305286587705883-balancer-l7leveler-kubr-yp-sas-228-BAL"}}}},"type":"serp-footer"},"2_b9333":{"state":{"conditionLoadList":{"marketCart":false,"highchartsHighstock":false,"advProductGallery":false,"musicPlayer":false,"ecomRates":false,"photoViewer":false,"easterEggModal":false,"easterEggPlusGamesModal":false,"futurisFeedbackLoader":false,"darkmodeChangeDrawer":true},"reportFeedbackBaseProps":{"initEmail":"","metaFields":{"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","userTestids":"1057327,470239,186144,1092870,1107293,1089853,1107403,921940,1110627,1106048,1109511,1112952,1109514,1100019,1104216,1112595,1112526,1089203,1106907,1109824,1091974,1107077,936723,1074448,1113642,1106423,1105093,1112161,1112578,1112945,1113454,1106631,1112119,1107127,1114601,1107248,658770,364898,1111779,1099274,1105751,1110531,260561,1097432,1097908,1107795,1105914,1113289,1102567,1113732,1109384,1111496,1106021,1109407,1109562,1107522,1101823,1103306,1112189,1102550,1110077,1099266,1101988,1107617,151171,1106127,1069988,287509,1101312,338390,785124,1103876,1106258,1104208,1112004,1109775,1111180,1098665,1112620,1105461,1097894,1092850,1102860","yandexuid":"4877058831726515912","uid":"0","queryText":"pragma comment lib","reqid":"1726515912769766-12286305286587705883-balancer-l7leveler-kubr-yp-sas-228-BAL","searchSlices":["drawer_search_slice_english","drawer_search_slice_cs"],"userRegionName":"Columbus","userRegionId":"20815","isChildAccount":false}},"extralinksPopupProps":{"abuseLink":"https://twitter.yandex.com.tr/search/abuse?sign=0763bef523731173e644e89e3672b9e2&keyno=0"},"isLoggedIn":false,"userMenuDialogProps":{"flag":"skin,feedback","host":"yandex.com.tr","lang":"tr","project":"serp","queryParams":{"utm_source":"search"},"retpath":"https%3A%2F%2Ftwitter.yandex.com.tr%2Fsearch%2F%3Ffilters_docs%3Ddirect_cm%26lr%3D20815%26text%3Dpragma%2Bcomment%2Blib%26ncrnd%3D61247","tld":"com.tr"},"baobab":{"parentNode":{"context":{"genInfo":{"prefix":"2_b933w0e-0-1"},"ui":"desktop","service":"web","reqid":"1726515912769766-12286305286587705883-balancer-l7leveler-kubr-yp-sas-228-BAL","fast":{"name":"lazy-load"}}}}},"type":"lazy-load"}}