2014-12-07 2 views
1

을 구축 할 때 때 건물 :이 NODEFAULTLIB/추가 : 라이브러리를 다음과 같은 오류를 얻기

1>------ Rebuild All started: Project: hw2_hci, Configuration: Release Win32 ------ 
1> Source.cpp 
1>Source.cpp(373): warning C4551: function call missing argument list 
1>Source.cpp(627): warning C4551: function call missing argument list 
1>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library 
1>glfw3.lib(wgl_context.obj) : error LNK2001: unresolved external symbol [email protected] 
1>glfw3.lib(wgl_context.obj) : error LNK2001: unresolved external symbol [email protected] 
1>glfw3.lib(wgl_context.obj) : error LNK2001: unresolved external symbol [email protected] 
1>glfw3.lib(win32_monitor.obj) : error LNK2001: unresolved external symbol [email protected] 
1>glfw3.lib(win32_gamma.obj) : error LNK2001: unresolved external symbol [email protected] 
1>glfw3.lib(win32_monitor.obj) : error LNK2001: unresolved external symbol [email protected] 
1>glfw3.lib(win32_gamma.obj) : error LNK2001: unresolved external symbol [email protected] 
1>glfw3.lib(win32_monitor.obj) : error LNK2001: unresolved external symbol [email protected] 
1>glfw3.lib(win32_gamma.obj) : error LNK2001: unresolved external symbol [email protected] 
1>glfw3.lib(win32_gamma.obj) : error LNK2001: unresolved external symbol [email protected] 
1>C:\Users\student\Documents\VSTest\hw2_hci\Release\hw2_hci.exe : fatal error LNK1120: 8 unresolved externals 
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ========== 

추가 한 다음, 같은 오류 : enter image description here

그리고이 :

enter image description here

이 문제가 발생할 때 Use MFC in a Static Library. 왜 이런 일이 일어나는 걸까요?

다른 사람이 this 페이지로 이동하도록 제안 했으므로 다음과 같이 추가했습니다.

enter image description here

그리고 오류 : gdi32.lib를 추가 한 후 나는 다음과 같은 오류 가지고 enter image description here

:

1> Finished generating code 
1>MSVCRT.lib(MSVCR110.dll) : error LNK2005: _calloc already defined in LIBCMT.lib(calloc.obj) 
1>MSVCRT.lib(MSVCR110.dll) : error LNK2005: _free already defined in LIBCMT.lib(free.obj) 
1>MSVCRT.lib(MSVCR110.dll) : error LNK2005: _realloc already defined in LIBCMT.lib(realloc.obj) 
1>MSVCRT.lib(MSVCR110.dll) : error LNK2005: __strdup already defined in LIBCMT.lib(strdup.obj) 
1>MSVCRT.lib(ti_inst.obj) : error LNK2005: "private: __thiscall type_info::type_info(class type_info const &)" ([email protected]@[email protected]@@Z) already defined in LIBCMT.lib(typinfo.obj) 
1>MSVCRT.lib(ti_inst.obj) : error LNK2005: "private: class type_info & __thiscall type_info::operator=(class type_info const &)" ([email protected]@[email protected]@@Z) already defined in LIBCMT.lib(typinfo.obj) 
1>C:\Users\student\Documents\VSTest\hw2_hci\Release\hw2_hci.exe : fatal error LNK1169: one or more multiply defined symbols found 
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== 
+1

추가 종속성에 user32.lib를 추가해야 할 수도 있습니다. – cup

+0

@cup 나는 그것을 추가하여 실제로 몇 가지 문제를 해결했습니다! 그러나 몇 가지 더 남아 있습니다! –

+1

gdi32.lib도 필요합니다. – cup

답변

1

무엇 일어나는 것은을 하나 이상의 지정한 기본 라이브러리 (아마도 당신이 사용하고있는 라이브러리에있는) 객체들이 런타임 라이브러리와 링크되도록 요청하고 있습니다. y는 프로젝트에서 사용하는 것과 다릅니다.

docs on LNK4098은 현재 진행중인 작업과 문제를 해결하는 방법에 대해 상당히 명확합니다.

+0

이 경우'glfw3.lib'는'Multi-threaded DLL (/ MD)'을 사용하고 있습니까? 내가'Multi-threaded (/ MT) '를 사용하여 프로젝트를 만들었습니까? 문제가있는 곳입니까? (나는 Visual Studio C++에 익숙하지 않다는 사과을합니다.) –

+0

제안 된 도움이 도움이되지 않았다는 것을 알고 있습니다! –

0

'추가 옵션'에서 무시할 라이브러리를 추가하지 말고 링커/입력/특정 기본 라이브러리 무시 '에서 추가하십시오 (이미 glfw3.lib가있는 것을 볼 수 있습니다. libcmt.lib를 세미콜론).

관련 문제