성태의 닷넷 이야기
홈 주인
모아 놓은 자료
프로그래밍
질문/답변
사용자 관리
사용자
메뉴
아티클
외부 아티클
유용한 코드
온라인 기능
MathJax 입력기
최근 덧글
[정성태] VT sequences to "CONOUT$" vs. STD_O...
[정성태] NetCoreDbg is a managed code debugg...
[정성태] Evaluating tail call elimination in...
[정성태] What’s new in System.Text.Json in ....
[정성태] What's new in .NET 9: Cryptography ...
[정성태] 아... 제시해 주신 "https://akrzemi1.wordp...
[정성태] 다시 질문을 정리할 필요가 있을 것 같습니다. 제가 본문에...
[이승준] 완전히 잘못 짚었습니다. 댓글 지우고 싶네요. 검색을 해보...
[정성태] 우선 답글 감사합니다. ^^ 그런데, 사실 저 예제는 (g...
[이승준] 수정이 안되어서... byteArray는 BYTE* 타입입니다...
글쓰기
제목
이름
암호
전자우편
HTML
홈페이지
유형
제니퍼 .NET
닷넷
COM 개체 관련
스크립트
VC++
VS.NET IDE
Windows
Team Foundation Server
디버깅 기술
오류 유형
개발 환경 구성
웹
기타
Linux
Java
DDK
Math
Phone
Graphics
사물인터넷
부모글 보이기/감추기
내용
<div style='display: inline'> <h1 style='font-family: Malgun Gothic, Consolas; font-size: 20pt; color: #006699; text-align: center; font-weight: bold'>Visual Studio - /NODEFAULTLIB 옵션 설정 후 수동으로 추가해야 할 library</h1> <p> 간단하게 Visual C++ Console Application 프로젝트를 만들고, 소스코드를 다음과 같이 구성합니다.<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > class CTest { }; int main() { CTest* ptr = new CTest(); } </pre> <a name='nostdlib'></a> <br /> 이 상태에서 프로젝트 속성 창을 통해 "Yes (/NODEFAULTLIB)" 옵션을 주면,<br /> <br /> <img onclick='toggle_img(this)' class='imgView' alt='nodefaultlib_1.png' src='/SysWebRes/bbs/nodefaultlib_1.png' /><br /> <br /> 이제 빌드 시 다음과 같은 오류가 발생합니다.<br /> <br /> <pre style='height: 400px; margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > Error LNK2019 unresolved external symbol "void * __cdecl operator new(unsigned __int64)" (??2@YAPEAX_K@Z) referenced in function main ConsoleApplication1 C:\temp\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.obj 1 Error LNK2019 unresolved external symbol strlen referenced in function "public: static unsigned __int64 __cdecl std::_Narrow_char_traits<char,int>::length(char const * const)" (?length@?$_Narrow_char_traits@DH@std@@SA_KQEBD@Z) ConsoleApplication1 C:\temp\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.obj 1 Error LNK2019 unresolved external symbol "bool __cdecl std::uncaught_exception(void)" (?uncaught_exception@std@@YA_NXZ) referenced in function "public: __cdecl std::basic_ostream<char,struct std::char_traits<char> >::sentry::~sentry(void)" (??1sentry@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAA@XZ) ConsoleApplication1 C:\temp\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.obj 1 Error LNK2019 unresolved external symbol "__declspec(dllimport) public: bool __cdecl std::ios_base::good(void)const " (__imp_?good@ios_base@std@@QEBA_NXZ) referenced in function "public: __cdecl std::basic_ostream<char,struct std::char_traits<char> >::sentry::sentry(class std::basic_ostream<char,struct std::char_traits<char> > &)" (??0sentry@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAA@AEAV12@@Z) ConsoleApplication1 C:\temp\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.obj 1 Error LNK2019 unresolved external symbol "__declspec(dllimport) public: int __cdecl std::ios_base::flags(void)const " (__imp_?flags@ios_base@std@@QEBAHXZ) referenced in function "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl std::operator<<<struct std::char_traits<char> >(class std::basic_ostream<char,struct std::char_traits<char> > &,char const *)" (??$?6U?$char_traits@D@std@@@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@0@AEAV10@PEBD@Z) ConsoleApplication1 C:\temp\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.obj 1 Error LNK2019 unresolved external symbol "__declspec(dllimport) public: __int64 __cdecl std::ios_base::width(void)const " (__imp_?width@ios_base@std@@QEBA_JXZ) referenced in function "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl std::operator<<<struct std::char_traits<char> >(class std::basic_ostream<char,struct std::char_traits<char> > &,char const *)" (??$?6U?$char_traits@D@std@@@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@0@AEAV10@PEBD@Z) ConsoleApplication1 C:\temp\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.obj 1 Error LNK2019 unresolved external symbol "__declspec(dllimport) public: __int64 __cdecl std::ios_base::width(__int64)" (__imp_?width@ios_base@std@@QEAA_J_J@Z) referenced in function "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl std::operator<<<struct std::char_traits<char> >(class std::basic_ostream<char,struct std::char_traits<char> > &,char const *)" (??$?6U?$char_traits@D@std@@@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@0@AEAV10@PEBD@Z) ConsoleApplication1 C:\temp\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.obj 1 Error LNK2019 unresolved external symbol "__declspec(dllimport) public: int __cdecl std::basic_streambuf<char,struct std::char_traits<char> >::sputc(char)" (__imp_?sputc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAAHD@Z) referenced in function "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl std::operator<<<struct std::char_traits<char> >(class std::basic_ostream<char,struct std::char_traits<char> > &,char const *)" (??$?6U?$char_traits@D@std@@@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@0@AEAV10@PEBD@Z) ConsoleApplication1 C:\temp\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.obj 1 Error LNK2019 unresolved external symbol "__declspec(dllimport) public: __int64 __cdecl std::basic_streambuf<char,struct std::char_traits<char> >::sputn(char const *,__int64)" (__imp_?sputn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAA_JPEBD_J@Z) referenced in function "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl std::operator<<<struct std::char_traits<char> >(class std::basic_ostream<char,struct std::char_traits<char> > &,char const *)" (??$?6U?$char_traits@D@std@@@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@0@AEAV10@PEBD@Z) ConsoleApplication1 C:\temp\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.obj 1 Error LNK2019 unresolved external symbol "__declspec(dllimport) public: void __cdecl std::basic_ios<char,struct std::char_traits<char> >::setstate(int,bool)" (__imp_?setstate@?$basic_ios@DU?$char_traits@D@std@@@std@@QEAAXH_N@Z) referenced in function "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl std::operator<<<struct std::char_traits<char> >(class std::basic_ostream<char,struct std::char_traits<char> > &,char const *)" (??$?6U?$char_traits@D@std@@@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@0@AEAV10@PEBD@Z) ConsoleApplication1 C:\temp\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.obj 1 Error LNK2019 unresolved external symbol "__declspec(dllimport) public: class std::basic_ostream<char,struct std::char_traits<char> > * __cdecl std::basic_ios<char,struct std::char_traits<char> >::tie(void)const " (__imp_?tie@?$basic_ios@DU?$char_traits@D@std@@@std@@QEBAPEAV?$basic_ostream@DU?$char_traits@D@std@@@2@XZ) referenced in function "public: __cdecl std::basic_ostream<char,struct std::char_traits<char> >::sentry::sentry(class std::basic_ostream<char,struct std::char_traits<char> > &)" (??0sentry@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAA@AEAV12@@Z) ConsoleApplication1 C:\temp\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.obj 1 Error LNK2019 unresolved external symbol "__declspec(dllimport) public: class std::basic_streambuf<char,struct std::char_traits<char> > * __cdecl std::basic_ios<char,struct std::char_traits<char> >::rdbuf(void)const " (__imp_?rdbuf@?$basic_ios@DU?$char_traits@D@std@@@std@@QEBAPEAV?$basic_streambuf@DU?$char_traits@D@std@@@2@XZ) referenced in function "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl std::operator<<<struct std::char_traits<char> >(class std::basic_ostream<char,struct std::char_traits<char> > &,char const *)" (??$?6U?$char_traits@D@std@@@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@0@AEAV10@PEBD@Z) ConsoleApplication1 C:\temp\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.obj 1 Error LNK2019 unresolved external symbol "__declspec(dllimport) public: char __cdecl std::basic_ios<char,struct std::char_traits<char> >::fill(void)const " (__imp_?fill@?$basic_ios@DU?$char_traits@D@std@@@std@@QEBADXZ) referenced in function "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl std::operator<<<struct std::char_traits<char> >(class std::basic_ostream<char,struct std::char_traits<char> > &,char const *)" (??$?6U?$char_traits@D@std@@@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@0@AEAV10@PEBD@Z) ConsoleApplication1 C:\temp\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.obj 1 Error LNK2019 unresolved external symbol "__declspec(dllimport) public: void __cdecl std::basic_ostream<char,struct std::char_traits<char> >::_Osfx(void)" (__imp_?_Osfx@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAXXZ) referenced in function "public: __cdecl std::basic_ostream<char,struct std::char_traits<char> >::sentry::~sentry(void)" (??1sentry@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAA@XZ) ConsoleApplication1 C:\temp\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.obj 1 Error LNK2019 unresolved external symbol "__declspec(dllimport) public: class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl std::basic_ostream<char,struct std::char_traits<char> >::flush(void)" (__imp_?flush@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@XZ) referenced in function "public: __cdecl std::basic_ostream<char,struct std::char_traits<char> >::sentry::sentry(class std::basic_ostream<char,struct std::char_traits<char> > &)" (??0sentry@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAA@AEAV12@@Z) ConsoleApplication1 C:\temp\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.obj 1 Error LNK2019 unresolved external symbol _RTC_CheckStackVars referenced in function "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl std::operator<<<struct std::char_traits<char> >(class std::basic_ostream<char,struct std::char_traits<char> > &,char const *)" (??$?6U?$char_traits@D@std@@@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@0@AEAV10@PEBD@Z) ConsoleApplication1 C:\temp\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.obj 1 Error LNK2001 unresolved external symbol _RTC_InitBase ConsoleApplication1 C:\temp\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.obj 1 Error LNK2001 unresolved external symbol _RTC_Shutdown ConsoleApplication1 C:\temp\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.obj 1 Error LNK2001 unresolved external symbol __CxxFrameHandler4 ConsoleApplication1 C:\temp\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.obj 1 Error LNK2001 unresolved external symbol __GSHandlerCheck_EH4 ConsoleApplication1 C:\temp\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.obj 1 Error LNK2019 unresolved external symbol __security_check_cookie referenced in function "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl std::operator<<<struct std::char_traits<char> >(class std::basic_ostream<char,struct std::char_traits<char> > &,char const *)" (??$?6U?$char_traits@D@std@@@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@0@AEAV10@PEBD@Z) ConsoleApplication1 C:\temp\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.obj 1 Error LNK2019 unresolved external symbol "__declspec(dllimport) class std::basic_ostream<char,struct std::char_traits<char> > std::cout" (__imp_?cout@std@@3V?$basic_ostream@DU?$char_traits@D@std@@@1@A) referenced in function main ConsoleApplication1 C:\temp\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.obj 1 Error LNK2019 unresolved external symbol __security_cookie referenced in function "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl std::operator<<<struct std::char_traits<char> >(class std::basic_ostream<char,struct std::char_traits<char> > &,char const *)" (??$?6U?$char_traits@D@std@@@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@0@AEAV10@PEBD@Z) ConsoleApplication1 C:\temp\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.obj 1 Error LNK2001 unresolved external symbol mainCRTStartup ConsoleApplication1 C:\temp\ConsoleApplication1\ConsoleApplication1\LINK 1 Error LNK1120 24 unresolved externals ConsoleApplication1 C:\temp\ConsoleApplication1\x64\Debug\ConsoleApplication1.exe 1 </pre> <br /> 오류를 보면, 가장 기본적인 new 연산자조차 없는 걸로 나옵니다.<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > LNK2019 unresolved external symbol "void * __cdecl operator new(unsigned __int64)" (??2@YAPEAX_K@Z) referenced in function main </pre> <br /> 예전에 이에 대해 정리한 적이 있는데요,<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > MASM + CRT 함수를 사용하는 경우 발생하는 컴파일 오류 정리 ; <a target='tab' href='https://www.sysnet.pe.kr/2/0/13183'>https://www.sysnet.pe.kr/2/0/13183</a> </pre> <br /> 따라서 위와 같은 소스코드에서는 다음의 3개 library를 "Additional Dependencies"추가하면,<br /> <br /> <img onclick='toggle_img(this)' class='imgView' alt='nodefaultlib_2.png' src='/SysWebRes/bbs/nodefaultlib_2.png' /><br /> <br /> <ul> <li>vcruntime.lib</li> <li>ucrt.lib</li> <li>libcmt.lib</li> </ul> <br /> 정상적으로 빌드가 됩니다.<br /> <br /> <hr style='width: 50%' /><br /> <br /> 자, 그럼 소스코드에 stl을 사용해 볼까요? ^^<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > #include <iostream> class CTest { }; int main() { std::cout << "Hello World!\n"; CTest* ptr = new CTest(); } </pre> <br /> 이제는 또다시 링커 에러가 발생하는데요,<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > Severity Code Description Project File Line Suppression State Error LNK2019 unresolved external symbol "bool __cdecl std::uncaught_exception(void)" (?uncaught_exception@std@@YA_NXZ) referenced in function "public: __cdecl std::basic_ostream<char,struct std::char_traits<char> >::sentry::~sentry(void)" (??1sentry@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAA@XZ) ConsoleApplication1 E:\cloud_drive\Dropbox\articles\waveDest_compile\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.obj 1 Error LNK2019 unresolved external symbol "__declspec(dllimport) public: bool __cdecl std::ios_base::good(void)const " (__imp_?good@ios_base@std@@QEBA_NXZ) referenced in function "public: __cdecl std::basic_ostream<char,struct std::char_traits<char> >::sentry::sentry(class std::basic_ostream<char,struct std::char_traits<char> > &)" (??0sentry@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAA@AEAV12@@Z) ConsoleApplication1 E:\cloud_drive\Dropbox\articles\waveDest_compile\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.obj 1 Error LNK2019 unresolved external symbol "__declspec(dllimport) public: int __cdecl std::ios_base::flags(void)const " (__imp_?flags@ios_base@std@@QEBAHXZ) referenced in function "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl std::operator<<<struct std::char_traits<char> >(class std::basic_ostream<char,struct std::char_traits<char> > &,char const *)" (??$?6U?$char_traits@D@std@@@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@0@AEAV10@PEBD@Z) ConsoleApplication1 E:\cloud_drive\Dropbox\articles\waveDest_compile\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.obj 1 Error LNK2019 unresolved external symbol "__declspec(dllimport) public: __int64 __cdecl std::ios_base::width(void)const " (__imp_?width@ios_base@std@@QEBA_JXZ) referenced in function "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl std::operator<<<struct std::char_traits<char> >(class std::basic_ostream<char,struct std::char_traits<char> > &,char const *)" (??$?6U?$char_traits@D@std@@@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@0@AEAV10@PEBD@Z) ConsoleApplication1 E:\cloud_drive\Dropbox\articles\waveDest_compile\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.obj 1 Error LNK2019 unresolved external symbol "__declspec(dllimport) public: __int64 __cdecl std::ios_base::width(__int64)" (__imp_?width@ios_base@std@@QEAA_J_J@Z) referenced in function "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl std::operator<<<struct std::char_traits<char> >(class std::basic_ostream<char,struct std::char_traits<char> > &,char const *)" (??$?6U?$char_traits@D@std@@@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@0@AEAV10@PEBD@Z) ConsoleApplication1 E:\cloud_drive\Dropbox\articles\waveDest_compile\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.obj 1 Error LNK2019 unresolved external symbol "__declspec(dllimport) public: int __cdecl std::basic_streambuf<char,struct std::char_traits<char> >::sputc(char)" (__imp_?sputc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAAHD@Z) referenced in function "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl std::operator<<<struct std::char_traits<char> >(class std::basic_ostream<char,struct std::char_traits<char> > &,char const *)" (??$?6U?$char_traits@D@std@@@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@0@AEAV10@PEBD@Z) ConsoleApplication1 E:\cloud_drive\Dropbox\articles\waveDest_compile\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.obj 1 Error LNK2019 unresolved external symbol "__declspec(dllimport) public: __int64 __cdecl std::basic_streambuf<char,struct std::char_traits<char> >::sputn(char const *,__int64)" (__imp_?sputn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAA_JPEBD_J@Z) referenced in function "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl std::operator<<<struct std::char_traits<char> >(class std::basic_ostream<char,struct std::char_traits<char> > &,char const *)" (??$?6U?$char_traits@D@std@@@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@0@AEAV10@PEBD@Z) ConsoleApplication1 E:\cloud_drive\Dropbox\articles\waveDest_compile\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.obj 1 Error LNK2019 unresolved external symbol "__declspec(dllimport) public: void __cdecl std::basic_ios<char,struct std::char_traits<char> >::setstate(int,bool)" (__imp_?setstate@?$basic_ios@DU?$char_traits@D@std@@@std@@QEAAXH_N@Z) referenced in function "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl std::operator<<<struct std::char_traits<char> >(class std::basic_ostream<char,struct std::char_traits<char> > &,char const *)" (??$?6U?$char_traits@D@std@@@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@0@AEAV10@PEBD@Z) ConsoleApplication1 E:\cloud_drive\Dropbox\articles\waveDest_compile\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.obj 1 Error LNK2019 unresolved external symbol "__declspec(dllimport) public: class std::basic_ostream<char,struct std::char_traits<char> > * __cdecl std::basic_ios<char,struct std::char_traits<char> >::tie(void)const " (__imp_?tie@?$basic_ios@DU?$char_traits@D@std@@@std@@QEBAPEAV?$basic_ostream@DU?$char_traits@D@std@@@2@XZ) referenced in function "public: __cdecl std::basic_ostream<char,struct std::char_traits<char> >::sentry::sentry(class std::basic_ostream<char,struct std::char_traits<char> > &)" (??0sentry@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAA@AEAV12@@Z) ConsoleApplication1 E:\cloud_drive\Dropbox\articles\waveDest_compile\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.obj 1 Error LNK2019 unresolved external symbol "__declspec(dllimport) public: class std::basic_streambuf<char,struct std::char_traits<char> > * __cdecl std::basic_ios<char,struct std::char_traits<char> >::rdbuf(void)const " (__imp_?rdbuf@?$basic_ios@DU?$char_traits@D@std@@@std@@QEBAPEAV?$basic_streambuf@DU?$char_traits@D@std@@@2@XZ) referenced in function "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl std::operator<<<struct std::char_traits<char> >(class std::basic_ostream<char,struct std::char_traits<char> > &,char const *)" (??$?6U?$char_traits@D@std@@@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@0@AEAV10@PEBD@Z) ConsoleApplication1 E:\cloud_drive\Dropbox\articles\waveDest_compile\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.obj 1 Error LNK2019 unresolved external symbol "__declspec(dllimport) public: char __cdecl std::basic_ios<char,struct std::char_traits<char> >::fill(void)const " (__imp_?fill@?$basic_ios@DU?$char_traits@D@std@@@std@@QEBADXZ) referenced in function "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl std::operator<<<struct std::char_traits<char> >(class std::basic_ostream<char,struct std::char_traits<char> > &,char const *)" (??$?6U?$char_traits@D@std@@@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@0@AEAV10@PEBD@Z) ConsoleApplication1 E:\cloud_drive\Dropbox\articles\waveDest_compile\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.obj 1 Error LNK2019 unresolved external symbol "__declspec(dllimport) public: void __cdecl std::basic_ostream<char,struct std::char_traits<char> >::_Osfx(void)" (__imp_?_Osfx@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAXXZ) referenced in function "public: __cdecl std::basic_ostream<char,struct std::char_traits<char> >::sentry::~sentry(void)" (??1sentry@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAA@XZ) ConsoleApplication1 E:\cloud_drive\Dropbox\articles\waveDest_compile\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.obj 1 Error LNK2019 unresolved external symbol "__declspec(dllimport) public: class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl std::basic_ostream<char,struct std::char_traits<char> >::flush(void)" (__imp_?flush@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@XZ) referenced in function "public: __cdecl std::basic_ostream<char,struct std::char_traits<char> >::sentry::sentry(class std::basic_ostream<char,struct std::char_traits<char> > &)" (??0sentry@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAA@AEAV12@@Z) ConsoleApplication1 E:\cloud_drive\Dropbox\articles\waveDest_compile\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.obj 1 Error LNK2019 unresolved external symbol "__declspec(dllimport) class std::basic_ostream<char,struct std::char_traits<char> > std::cout" (__imp_?cout@std@@3V?$basic_ostream@DU?$char_traits@D@std@@@1@A) referenced in function main ConsoleApplication1 E:\cloud_drive\Dropbox\articles\waveDest_compile\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.obj 1 Error LNK1120 14 unresolved externals ConsoleApplication1 E:\cloud_drive\Dropbox\articles\waveDest_compile\ConsoleApplication1\x64\Debug\ConsoleApplication1.exe 1 </pre> <br /> 이에 대해서는 다음의 문서에 따라,<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > C runtime (CRT) and C++ standard library (STL) .lib files ; <a target='tab' href='https://learn.microsoft.com/en-us/cpp/c-runtime-library/crt-library-features?view=msvc-170#c-standard-library-stl-lib-files'>https://learn.microsoft.com/en-us/cpp/c-runtime-library/crt-library-features?view=msvc-170#c-standard-library-stl-lib-files</a> </pre> <br /> "C++ standard library (STL) .lib files"를 위해 (문서에 나오는 것 중에서, 여기서는) msvcprt.lib와 링크하도록 설정을 추가합니다. 따라서, 대부분의 Visual C++ 프로젝트라면 다음의 4개 lib를 추가하면 됩니다. <br /> <br /> <ul> <li>vcruntime.lib</li> <li>ucrt.lib</li> <li>libcmt.lib</li> <li>msvcprt.lib</li> </ul> <br /> 위의 목록은 Release 빌드용이므로 디버깅을 위해서 'd' 글자가 붙은 버전을 사용할 수 있습니다.<br /> <br /> <ul> <li>vcruntimed.lib</li> <li>ucrtd.lib</li> <li>libcpmtd.lib</li> <li>msvcprtd.lib</li> </ul> <br /> 참고로 필요한 lib 파일명은 Visual Studio의 버전에 따라 달라질 수 있으므로 문서 링크에 있는 "view=msvc-170" 값에 따라 적절하게 찾아야 합니다.<br /> <br /> <hr style='width: 50%' /><br /> <br /> libcmt.lib 없이 vcruntime.lib, ucrt.lib만 포함시키면 이렇게 링커 오류가 발생합니다.<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > Severity Code Description Project File Line Suppression State Error LNK2019 unresolved external symbol "void * __cdecl operator new(unsigned __int64)" (??2@YAPEAX_K@Z) referenced in function main ConsoleApplication1 C:\temp\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.obj 1 Error LNK2001 unresolved external symbol _RTC_InitBase ConsoleApplication1 C:\temp\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.obj 1 Error LNK2001 unresolved external symbol _RTC_Shutdown ConsoleApplication1 C:\temp\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.obj 1 Error LNK2001 unresolved external symbol mainCRTStartup ConsoleApplication1 C:\temp\ConsoleApplication1\ConsoleApplication1\LINK 1 Error LNK1120 4 unresolved externals ConsoleApplication1 C:\temp\ConsoleApplication1\x64\Debug\ConsoleApplication1.exe 1 </pre> <br /> 또한, "$(CoreLibraryDependencies)"로 추가되는 라이브러리들은 다음과 같습니다.<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib </pre> </p><br /> <br /><hr /><span style='color: Maroon'>[이 글에 대해서 여러분들과 의견을 공유하고 싶습니다. 틀리거나 미흡한 부분 또는 의문 사항이 있으시면 언제든 댓글 남겨주십시오.]</span> </div>
첨부파일
스팸 방지용 인증 번호
1927
(왼쪽의 숫자를 입력해야 합니다.)