English 中文(简体)
我可以在2010年演播室观看。
原标题:I can t compile in Visual Studio 2010

I always have so many problems compiling programs in Visual Studio 2010. I apologize for my greenness. I am getting LNK errors and am not sure what it causing them. I m hoping someone might be able to spot something from the build log. Probably something silly ...

Build started 4/8/2012 3:22:37 PM.
 1>Project "c:UsersDonalddocumentsvisual studio 2010ProjectsClientServermyClientmyClient.vcxproj" on node 2 (build target(s)).
 1>InitializeBuildStatus:
     Touching "DebugmyClient.unsuccessfulbuild".
   ClCompile:
     c:Program Files (x86)Microsoft Visual Studio 10.0VCinCL.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"Debugvc100.pdb" /Gd /TP /analyze- /errorReport:prompt mySocket.cpp
     mySocket.cpp
 1>c:usersdonalddocumentsvisual studio 2010projectsclientservermyclientmysocket.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.0vcincludestdio.h(371) : see declaration of  sprintf 
   ManifestResourceCompile:
     C:Program Files (x86)Microsoft SDKsWindowsv7.0Ain
c.exe /nologo /fo"DebugmyClient.exe.embed.manifest.res" DebugmyClient_manifest.rc 
   Link:
     c:Program Files (x86)Microsoft Visual Studio 10.0VCinlink.exe /ERRORREPORT:PROMPT /OUT:"c:usersdonalddocumentsvisual studio 2010ProjectsClientServerDebugmyClient.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:"DebugmyClient.exe.intermediate.manifest" /MANIFESTUAC:"level= asInvoker  uiAccess= false " /DEBUG /PDB:"c:usersdonalddocumentsvisual studio 2010ProjectsClientServerDebugmyClient.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"c:usersdonalddocumentsvisual studio 2010ProjectsClientServerDebugmyClient.lib" /MACHINE:X86 DebugmyClient.exe.embed.manifest.res
     DebugmyClient.obj
     DebugmyException.obj
     DebugmyHostInfo.obj
     DebugmyLog.obj
     DebugmySocket.obj
     Debugstdafx.obj
 1>myClient.obj : error LNK2019: unresolved external symbol __imp__inet_ntoa@4 referenced in function "public: char * __thiscall myHostInfo::getHostIPAddress(void)" (?getHostIPAddress@myHostInfo@@QAEPADXZ)
 1>mySocket.obj : error LNK2001: unresolved external symbol __imp__inet_ntoa@4
 1>myHostInfo.obj : error LNK2019: unresolved external symbol __imp__gethostbyname@4 referenced in function "public: __thiscall myHostInfo::myHostInfo(void)" (??0myHostInfo@@QAE@XZ)
 1>myHostInfo.obj : error LNK2019: unresolved external symbol __imp__gethostname@8 referenced in function "public: __thiscall myHostInfo::myHostInfo(void)" (??0myHostInfo@@QAE@XZ)
 1>myHostInfo.obj : error LNK2019: unresolved external symbol __imp__gethostbyaddr@12 referenced in function "public: __thiscall myHostInfo::myHostInfo(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &,enum hostType)" (??0myHostInfo@@QAE@AAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@W4hostType@@@Z)
 1>myHostInfo.obj : error LNK2019: unresolved external symbol __imp__inet_addr@4 referenced in function "public: __thiscall myHostInfo::myHostInfo(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &,enum hostType)" (??0myHostInfo@@QAE@AAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@W4hostType@@@Z)
 1>mySocket.obj : error LNK2001: unresolved external symbol __imp__inet_addr@4
 1>myHostInfo.obj : error LNK2019: unresolved external symbol __imp__WSAGetLastError@0 referenced in function "private: void __thiscall myHostInfo::detectErrorGethostbyname(int *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &)" (?detectErrorGethostbyname@myHostInfo@@AAEXPAHAAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
 1>mySocket.obj : error LNK2001: unresolved external symbol __imp__WSAGetLastError@0
 1>mySocket.obj : error LNK2019: unresolved external symbol __imp__htons@4 referenced in function __catch$??0mySocket@@QAE@H@Z$0
 1>mySocket.obj : error LNK2019: unresolved external symbol __imp__htonl@4 referenced in function __catch$??0mySocket@@QAE@H@Z$0
 1>mySocket.obj : error LNK2019: unresolved external symbol __imp__socket@12 referenced in function "public: __thiscall mySocket::mySocket(int)" (??0mySocket@@QAE@H@Z)
 1>mySocket.obj : error LNK2019: unresolved external symbol __imp__closesocket@4 referenced in function "public: virtual __thiscall mySocket::~mySocket(void)" (??1mySocket@@UAE@XZ)
 1>mySocket.obj : error LNK2019: unresolved external symbol __imp__setsockopt@20 referenced in function "public: void __thiscall mySocket::setDebug(int)" (?setDebug@mySocket@@QAEXH@Z)
 1>mySocket.obj : error LNK2019: unresolved external symbol __imp__ioctlsocket@12 referenced in function "public: void __thiscall mySocket::setSocketBlocking(int)" (?setSocketBlocking@mySocket@@QAEXH@Z)
 1>mySocket.obj : error LNK2019: unresolved external symbol __imp__getsockopt@20 referenced in function "public: int __thiscall mySocket::getDebug(void)" (?getDebug@mySocket@@QAEHXZ)
 1>mySocket.obj : error LNK2019: unresolved external symbol __imp__WSACleanup@0 referenced in function "public: virtual __thiscall myTcpSocket::~myTcpSocket(void)" (??1myTcpSocket@@UAE@XZ)
 1>mySocket.obj : error LNK2019: unresolved external symbol __imp__WSAStartup@8 referenced in function "public: static void __cdecl myTcpSocket::initialize(void)" (?initialize@myTcpSocket@@SAXXZ)
 1>mySocket.obj : error LNK2019: unresolved external symbol __imp__bind@12 referenced in function "public: void __thiscall myTcpSocket::bindSocket(void)" (?bindSocket@myTcpSocket@@QAEXXZ)
 1>mySocket.obj : error LNK2019: unresolved external symbol __imp__connect@12 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)" (?connectToServer@myTcpSocket@@UAEXAAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@W4hostType@@@Z)
 1>mySocket.obj : error LNK2019: unresolved external symbol __imp__accept@12 referenced in function "public: class myTcpSocket * __thiscall myTcpSocket::acceptClient(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &)" (?acceptClient@myTcpSocket@@QAEPAV1@AAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
 1>mySocket.obj : error LNK2019: unresolved external symbol __imp__listen@8 referenced in function "public: void __thiscall myTcpSocket::listenToClient(int)" (?listenToClient@myTcpSocket@@QAEXH@Z)
 1>mySocket.obj : error LNK2019: unresolved external symbol __imp__send@16 referenced in function "public: int __thiscall myTcpSocket::sendMessage(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &)" (?sendMessage@myTcpSocket@@QAEHAAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
 1>mySocket.obj : error LNK2019: unresolved external symbol __imp__recv@16 referenced in function "private: int __thiscall myTcpSocket::XPrecieveMessage(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &)" (?XPrecieveMessage@myTcpSocket@@AAEHAAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
 1>c:usersdonalddocumentsvisual studio 2010ProjectsClientServerDebugmyClient.exe : fatal error LNK1120: 21 unresolved externals
 1>Done Building Project "c:UsersDonalddocumentsvisual studio 2010ProjectsClientServermyClientmyClient.vcxproj" (build target(s)) -- FAILED.

Build FAILED.

Time Elapsed 00:00:03.54

希望得到任何帮助。 此前已对该法典进行了罚款。

最佳回答

上述错误表明,该链接器无法找到在Ws2_32图书馆中包含网络相关功能的标志。

添加这一图书馆,以连接参数:

  1. Open the project s Property Pages dialog box. For details, see Setting Visual C++ Project Properties.
  2. Click the Linker folder.
  3. Click the Input property page.
  4. Modify the Additional Dependencies property and add Ws2_32.lib
问题回答

暂无回答




相关问题
Undefined reference

I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...

C++ Equivalent of Tidy

Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...

Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

typedef ing STL wstring

Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

Window iconification status via Xlib

Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?

热门标签