2012-04-08 6 views
6

Visual Studio 2010에서 프로그램을 컴파일하는 데 항상 많은 문제가 있습니다. 내 초록색 사과드립니다. LNK 오류가 발생하고 무엇이 원인인지 확실하지 않습니다. 누군가가 빌드 로그에서 뭔가를 발견 할 수 있기를 바랍니다. 아마 뭔가 바보 같은 ...Visual Studio 2010에서 컴파일 할 수 없습니다.

Build started 4/8/2012 3:22:37 PM. 
1>Project "c:\Users\Donald\documents\visual studio 2010\Projects\ClientServer\myClient\myClient.vcxproj" on node 2 (build target(s)). 
1>InitializeBuildStatus: 
    Touching "Debug\myClient.unsuccessfulbuild". 
    ClCompile: 
    c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\CL.exe /c /ZI /nologo /W3 /WX- /Od /Oy- /D WIN32 /D _DEBUG /D _CONSOLE /D _UNICODE /D UNICODE /Gm /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Fo"Debug\\" /Fd"Debug\vc100.pdb" /Gd /TP /analyze- /errorReport:prompt mySocket.cpp 
    mySocket.cpp 
1>c:\users\donald\documents\visual studio 2010\projects\clientserver\myclient\mysocket.cpp(1191): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. 
      c:\program files (x86)\microsoft visual studio 10.0\vc\include\stdio.h(371) : see declaration of 'sprintf' 
    ManifestResourceCompile: 
    C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\rc.exe /nologo /fo"Debug\myClient.exe.embed.manifest.res" Debug\myClient_manifest.rc 
    Link: 
    c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\link.exe /ERRORREPORT:PROMPT /OUT:"c:\users\donald\documents\visual studio 2010\Projects\ClientServer\Debug\myClient.exe" /INCREMENTAL /NOLOGO kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MANIFEST /ManifestFile:"Debug\myClient.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"c:\users\donald\documents\visual studio 2010\Projects\ClientServer\Debug\myClient.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"c:\users\donald\documents\visual studio 2010\Projects\ClientServer\Debug\myClient.lib" /MACHINE:X86 Debug\myClient.exe.embed.manifest.res 
    Debug\myClient.obj 
    Debug\myException.obj 
    Debug\myHostInfo.obj 
    Debug\myLog.obj 
    Debug\mySocket.obj 
    Debug\stdafx.obj 
1>myClient.obj : error LNK2019: unresolved external symbol [email protected] referenced in function "public: char * __thiscall myHostInfo::getHostIPAddress(void)" ([email protected]@@QAEPADXZ) 
1>mySocket.obj : error LNK2001: unresolved external symbol [email protected] 
1>myHostInfo.obj : error LNK2019: unresolved external symbol [email protected] referenced in function "public: __thiscall myHostInfo::myHostInfo(void)" ([email protected]@[email protected]) 
1>myHostInfo.obj : error LNK2019: unresolved external symbol [email protected] referenced in function "public: __thiscall myHostInfo::myHostInfo(void)" ([email protected]@[email protected]) 
1>myHostInfo.obj : error LNK2019: unresolved external symbol [email protected] referenced in function "public: __thiscall myHostInfo::myHostInfo(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &,enum hostType)" ([email protected]@[email protected][email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]@@Z) 
1>myHostInfo.obj : error LNK2019: unresolved external symbol [email protected] referenced in function "public: __thiscall myHostInfo::myHostInfo(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &,enum hostType)" ([email protected]@[email protected][email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]@@Z) 
1>mySocket.obj : error LNK2001: unresolved external symbol [email protected] 
1>myHostInfo.obj : error LNK2019: unresolved external symbol [email protected] referenced in function "private: void __thiscall myHostInfo::detectErrorGethostbyname(int *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &)" ([email protected]@@[email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@@Z) 
1>mySocket.obj : error LNK2001: unresolved external symbol [email protected] 
1>mySocket.obj : error LNK2019: unresolved external symbol [email protected] referenced in function [email protected]@[email protected]@Z$0 
1>mySocket.obj : error LNK2019: unresolved external symbol [email protected] referenced in function [email protected]@[email protected]@Z$0 
1>mySocket.obj : error LNK2019: unresolved external symbol [email protected] referenced in function "public: __thiscall mySocket::mySocket(int)" ([email protected]@[email protected]@Z) 
1>mySocket.obj : error LNK2019: unresolved external symbol [email protected] referenced in function "public: virtual __thiscall mySocket::~mySocket(void)" ([email protected]@[email protected]) 
1>mySocket.obj : error LNK2019: unresolved external symbol [email protected] referenced in function "public: void __thiscall mySocket::setDebug(int)" ([email protected]@@[email protected]) 
1>mySocket.obj : error LNK2019: unresolved external symbol [email protected] referenced in function "public: void __thiscall mySocket::setSocketBlocking(int)" ([email protected]@@[email protected]) 
1>mySocket.obj : error LNK2019: unresolved external symbol [email protected] referenced in function "public: int __thiscall mySocket::getDebug(void)" ([email protected]@@QAEHXZ) 
1>mySocket.obj : error LNK2019: unresolved external symbol [email protected] referenced in function "public: virtual __thiscall myTcpSocket::~myTcpSocket(void)" ([email protected]@[email protected]) 
1>mySocket.obj : error LNK2019: unresolved external symbol [email protected] referenced in function "public: static void __cdecl myTcpSocket::initialize(void)" ([email protected]@@SAXXZ) 
1>mySocket.obj : error LNK2019: unresolved external symbol [email protected] referenced in function "public: void __thiscall myTcpSocket::bindSocket(void)" ([email protected]@@QAEXXZ) 
1>mySocket.obj : error LNK2019: unresolved external symbol [email protected] referenced in function "public: virtual void __thiscall myTcpSocket::connectToServer(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &,enum hostType)" ([email protected]@@[email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]@@Z) 
1>mySocket.obj : error LNK2019: unresolved external symbol [email protected] referenced in function "public: class myTcpSocket * __thiscall myTcpSocket::acceptClient(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &)" ([email protected]@@[email protected][email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@@Z) 
1>mySocket.obj : error LNK2019: unresolved external symbol [email protected] referenced in function "public: void __thiscall myTcpSocket::listenToClient(int)" ([email protected]@@[email protected]) 
1>mySocket.obj : error LNK2019: unresolved external symbol [email protected] referenced in function "public: int __thiscall myTcpSocket::sendMessage(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &)" ([email protected]@@[email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@@Z) 
1>mySocket.obj : error LNK2019: unresolved external symbol [email protected] referenced in function "private: int __thiscall myTcpSocket::XPrecieveMessage(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &)" ([email protected]@@[email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@@Z) 
1>c:\users\donald\documents\visual studio 2010\Projects\ClientServer\Debug\myClient.exe : fatal error LNK1120: 21 unresolved externals 
1>Done Building Project "c:\Users\Donald\documents\visual studio 2010\Projects\ClientServer\myClient\myClient.vcxproj" (build target(s)) -- FAILED. 

Build FAILED. 

Time Elapsed 00:00:03.54 

어떤 도움을 주시면 감사하겠습니다. 코드는 이전에 잘 컴파일되었습니다.

+3

를 추가; 먼저 Hello World 예제와 같이 훨씬 더 단순한 것을 빌드하고 그 것이 작동하는지 확인하십시오. – sarnold

+3

하나 이상의 라이브러리가 누락되었습니다. 'gethostbyname'에 대한 내 질문에 대한 Google 응답은이 라이브러리 'Ws2_32.lib'을 암시하는 msdn 페이지였습니다. 프로젝트 옵션에 직접 추가하거나 'winsock2.h'를 포함하여 추가하십시오. – DaClown

+0

@sarnold 아, 그렇습니다. 나는 그 시점을 훨씬 넘었습니다. 안녕하세요 세상 작품 :) 나는 그걸 시도 DaClown – DonaldH

답변

15

위의 오류는 네트워크 관련 기능이 포함 된 Ws2_32 라이브러리에 포함 된 기호를 찾을 수 없다고 말합니다.

는 링커 매개 변수에이 라이브러리를 추가하려면 :

  1. 열기 프로젝트의 속성 페이지 대화 상자를. 자세한 내용은 Visual C++ 프로젝트 속성 설정을 참조하십시오.
  2. 링커 폴더를 클릭하십시오.
  3. 입력 속성 페이지를 클릭하십시오.
  4. 은 추가 종속성 속성을 수정하고 Ws2_32.lib 시작하는 복잡한 프로그램의
+0

우수 응답. 나는 LNK 코드에 대한 구글을 시도했지만 다음 번에 구글을 검색 할 때 오류에 대한 세부 사항을 좀 더 자세하게 다룰 것이다. 답장을 보내 주셔서 감사합니다. 또한 @DaClown – DonaldH

+1

내가 도울 수있어서 기쁩니다. – DaClown

관련 문제